0

我对 XNA 很陌生,我尝试加载模型,但没有正确加载。

该模型在 Visual Studio 中如下所示:

在此处输入图像描述

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

在此处输入图像描述

我的代码是这样的:

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

0 回答 0