Hello Codeproject,
I'm using the following code to draw a 2D sprite on the screen. However, my game uses Vector3(Allowing 3D if I adjusted the Z.)
This code is the matrix I use for my camera:
SpriteBatchMatrix = Matrix.CreateTranslation(-CameraPosition) *
Matrix.CreateRotationZ(CameraRotation) *
Matrix.CreateScale(new Vector3(CameraZoom, CameraZoom, 1)) *
Matrix.CreateTranslation(new Vector3(Viewport.Width * 0.5f, Viewport.Height * 0.5f,0));
This is the code I use to draw my sprites:
SpriteBatch.Begin(SpriteSortMode.Immediate,
BlendState.AlphaBlend,
null,
null,
null,
null,
Universe.Camera.SpriteBatchMatrix);
foreach (Particle Particle in Universe.Bodies)
{
SpriteBatch.Draw(TexturePlanet, new Rectangle((int)Particle.Position.X, (int)Particle.Position.Y, (int)(Particle.Mass), (int)(Particle.Mass)), new Rectangle(0, 0, TexturePlanet.Width, TexturePlanet.Height), Color.Lerp(Color.Black, Color.White, (Particle.Lighting + Particle.AdjacentLighting) / 100f), Particle.Rotation, new Vector2(TexturePlanet.Width / 2, TexturePlanet.Height / 2), SpriteEffects.None, 0f);
}
SpriteBatch.End();
How would I use this camera matrix to draw a 3D Triangle Strip(or model)?
Much Regards!