【问题标题】:MonoGame 3D - Triangles aren't visible when center Y < about -2.0MonoGame 3D - 当中心 Y < 约 -2.0 时三角形不可见
【发布时间】:2013-07-04 05:55:04
【问题描述】:

我有一个小的代码库,你可以在my current commit on GitHub 看到完整的代码。我将尝试将相关代码放在这里。基本上,如果我移动一个三角形的Position,它会改变世界矩阵,它就会变得不可见。有什么想法吗?

GraphicsDevice.RasterizerState.CullMode = CullMode.None;

this.vertices = new[]
{
    new VertexPositionColor(new Vector3(1.0f, -1.0f, 0.0f), color),
    new VertexPositionColor(new Vector3(-1.0f, -1.0f, 0.0f), color),
    new VertexPositionColor(new Vector3(0.0f, 1.0f, 0.0f), color)
};

this.effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4,
            device.Viewport.AspectRatio, 0.001f, 50.0f);
this.effect.View = Matrix.CreateLookAt(Position, Vector3.Down, Vector3.Forward);
this.effect.World = Matrix.CreateTranslation(entity.Position);

foreach (var pass in this.effect.CurrentTechnique.Passes)
{
    pass.Apply();
    this.device.DrawUserPrimitives(PrimitiveType.TriangleList, this.vertices,
        0, 1);
}

【问题讨论】:

    标签: 3d xna monogame


    【解决方案1】:

    问题最终是我的远剪辑太靠近我绘制三角形的位置(我在远剪辑上绘制)。

    简单!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多