模型是';t在visualstudio 2015加载
本文关键字:visualstudio 2015 加载 模型 | 更新日期: 2023-09-27 18:21:21
我有一个足球场的模型,我使用的是xna4.0,visual studio 2015可以用它的fbx查看器打开它,但当我将它加载到项目中时,什么都没有得到,模型有太多的三角形,所以我正确地使用了HiDef游戏配置文件和其他模型加载,模型是3ds模型,但我将其转换为fbx。这是绘图功能:
private void DrawModel(Model model, Matrix world, Matrix view, Matrix projection)
{
Matrix[] modelTransforms = new Matrix[model.Bones.Count];
foreach (ModelMesh mesh in model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.World = world;
effect.View = view;
effect.Projection = projection;
}
mesh.Draw();
}
}
试试这个:
private void DrawModel(Model model, Matrix world, Matrix view, Matrix projection)
{
Matrix[] modelTransforms = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(modelTransforms);
foreach (ModelMesh mesh in model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.World = world;
effect.View = view;
effect.Projection = projection;
}
mesh.Draw();
}
}