gpt4 book ai didi

c# - Silverlight 5 和 VertexBuffer.GetData()

转载 作者:太空狗 更新时间:2023-10-29 23:51:52 25 4
gpt4 key购买 nike

我正在尝试在 silverlight 5 中实现 3d 模型碰撞。为此,我正在创建一个 BoundingBox(就像在 XNA4.0 中一样):

我看到了同样的问题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;
}

最佳答案

出于安全原因,Microsoft 拒绝访问 GPU。所以他们有暂停 GetData() 方法。要解决 Silverlight 5 中的这个问题,您可以编写一个自定义内容管道来加载对象并尝试读取顶点数据,它可以解决您的问题。

关于c# - Silverlight 5 和 VertexBuffer.GetData(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14477080/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com