2013-01-23 39 views
5

मुझे लगता है कि मैं एक BoundingBox (बस XNA4.0 में) की तरह बनाने हूँ ऐसा करने के लिए Silverlight 5 में 3 डी मॉडल टक्कर प्राप्त करने के लिए कोशिश कर रहा हूँ:सिल्वरलाइट 5 और VertexBuffer.GetData()

मैं एक ही सवाल देखा VertexBuffer.GetData() and Silverlight 5 इस लिंक में लेकिन कोई जवाब नहीं मिला।

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; 
    } 

उत्तर

0

सुरक्षा कारण के लिए माइक्रोसॉफ्ट के पास GPU की ओर से इनकार किया गया है। इसलिए उन्होंने GetData() विधि को निलंबित कर दिया है। सिल्वरलाइट 5 में इस मुद्दे को दूर करने के लिए आप ऑब्जेक्ट को लोड करने के लिए एक कस्टम सामग्री पाइपलाइन लिख सकते हैं और कशेरुक डेटा को पढ़ने का प्रयास कर सकते हैं और यह आपकी समस्या हल करता है।