XNA 3D对象正确显示

时间:2015-01-02 16:38:43

标签: xna-4.0

我查看3D对象卡的代码就像这张图片一样查看。请检查此网址: https://lh3.googleusercontent.com/zKVd6Pnv0xzRcG5QdVpGSFnWbYDqyrC4vyF2n264NDE=w359-h207-p-no https://lh5.googleusercontent.com/ZAsvunwH18MpfGcYSCH7RY0DXhNZgZBrDXLLZIfw_U8=w316-h207-p-no

Vector3 cameraPosition = new Vector3(0.0f, 15.0f, -5.0f);
float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio; 

foreach (ModelMesh mesh in myModel.Meshes)
  {
    foreach (BasicEffect effect in mesh.Effects)
      {
        effect.World = Matrix.Identity;  
        effect.View = Matrix.CreateLookAt(cameraPosition,Vector3.Zero, Vector3.Up); 
        effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio,
                                1.0f, 8000.0f);
      }
    mesh.Draw();
 }

请帮我解决这个问题。

0 个答案:

没有答案