模特并没有在2015年的visual studio中加载

时间:2015-11-10 20:54:12

标签: c# 3d xna

我有一个足球场的模型,我使用xna4.0,视觉工作室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();
            }
        }

1 个答案:

答案 0 :(得分:0)

试试这个:

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