I want to render semi-dynamic 3D models... the built in Model class won't work.
So I thought I'd use a simple array of Vertices and render triangles from that...
I've looked all around the internet, and cannot figure out how to do it.
Here's what I'm currently trying:
GenMesh is called once, DrawMesh is called in the Draw loop somewhere shortly after the code
the drawmodel(Models.cube bit is just so I can make sure I've pointed the camera at the right spot.
All I see is the cube, no triangle.
- Also, I have CullMode set to None.
What am I missing here?
So I thought I'd use a simple array of Vertices and render triangles from that...
I've looked all around the internet, and cannot figure out how to do it.
Here's what I'm currently trying:
public static VertexPositionNormalTexture[] MapMesh = new VertexPositionNormalTexture[1];
public static void GenMesh()
{
MapMesh = new VertexPositionNormalTexture[3];
MapMesh[0].Position = new Vector3(-0.5f, -0.5f, 0f);
MapMesh[1].Position = new Vector3(0, 0.5f, 0.1f);
MapMesh[2].Position = new Vector3(0.5f, -0.5f, 0f);
}
public static void DrawMesh(GraphicsDevice device)
{
device.DrawUserPrimitives(PrimitiveType.TriangleList, MapMesh, 0, MapMesh.Length/3);
Models.drawmodel(Models.cube, new Vector3(-1, -1, -5), Vector3.Zero, Textures.textures[Console.constext], Vector3.One);
}
GenMesh is called once, DrawMesh is called in the Draw loop somewhere shortly after the code
// effect is a BasicEffect.
effect.View = (camera.ViewMatrix);
effect.Projection = (camera.ProjectionMatrix);
effect.World = (Matrix.Identity);
effect.TextureEnabled = true;
effect.Texture = Textures.White;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
}
the drawmodel(Models.cube bit is just so I can make sure I've pointed the camera at the right spot.
All I see is the cube, no triangle.
- Also, I have CullMode set to None.
What am I missing here?