如何将fbx模型加载到XNA?

时间:2013-10-06 16:44:20

标签: c# xna fbx

我是XNA的新手,我尝试加载模型,但没有正确加载。

该模型在visual studio中看起来像这样:

enter image description here

当我尝试显示时,它看起来像这样:

enter image description here

我的代码是:

        Matrix[] transforms = new Matrix[BilliardTable.Bones.Count];
        this.BilliardTable.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in this.BilliardTable.Meshes)
        {

            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationX(120)
                    * Matrix.CreateTranslation(Vector3.Zero);
                effect.View = Matrix.CreateLookAt(balls.First().cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(45.0f), balls.First().aspectRatio,
                    1.0f, 10000.0f);
            }
            mesh.Draw();
        }

0 个答案:

没有答案