2013-01-23 30 views
5

tôi đang cố gắng để đạt được mô hình va chạm 3d trong Silverlight 5. Để thực hiện điều mà tôi đang tạo ra một BoundingBox (giống như trong XNA4.0):Silverlight 5 và VertexBuffer.GetData()

tôi thấy cùng một câu hỏi VertexBuffer.GetData() and Silverlight 5 trong liên kết này nhưng không tìm thấy câu trả lời nào.

public BoundingBox GetBoundingBoxFromModel(Model model) 
    {    
     BoundingBox boundingBox = new BoundingBox(); 

      foreach (ModelMeshPart part in model.Meshes[0].MeshParts) 
      { 
       VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[part.NumVertices]; 
       Vector3[] vertexs = new Vector3[vertices.Length]; 

       part.VertexBuffer.GetData<VertexPositionNormalTexture>(vertices);      


       for (int index = 0; index < vertexs.Length; index++) 
       { 
        vertexs[index] = vertices[index].Position; 
       } 

       boundingBox = BoundingBox.CreateMerged(boundingBox, BoundingBox.CreateFromPoints(vertexs)); 
      }    
     return boundingBox; 
    } 

Trả lời

0

Vì lý do bảo mật Microsoft có quyền truy cập bị từ chối đối với GPU. Vì vậy, họ đã tạm ngưng phương thức GetData(). Để khắc phục vấn đề này trong Silverlight 5, bạn có thể viết một đường dẫn nội dung tùy chỉnh để tải đối tượng và cố đọc dữ liệu đỉnh và giải quyết vấn đề của bạn.

Các vấn đề liên quan