Reputation: 6307
I have a small code base, and you can see the full code at my current commit on GitHub. I will try to put the relevant code in here. Basically, if I move a triangle's Position
, which changes the World matrix, it becomes invisible. Any ideas?
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);
}
Upvotes: 0
Views: 140
Reputation: 6307
The problem ended up being that my far clip was too close to where I was drawing the triangles (I was drawing ON the far clip).
Simple!
Upvotes: 1