2013-01-23 6 views
5

私は(ちょうどXNA4.0のように)にBoundingBoxを作成していますことを行うにはシルバーライトを5で3Dモデルの衝突を達成しようとしています:のSilverlight 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()メソッドを中断しています。 Silverlight 5でこの問題を解決するには、カスタムコンテンツパイプラインを作成してオブジェクトをロードし、頂点データを読み込み、問題を解決することができます。

関連する問題