Example #1
0
        void DrawAxes()
        {
            PositionColored[] xAxis = new PositionColored[2] {
                new PositionColored(new Vector3(0), Color.Red.ToArgb()),
                new PositionColored(new Vector3(10, 0, 0), Color.Red.ToArgb()) };
            PositionColored[] yAxis = new PositionColored[2] {
                new PositionColored(new Vector3(0), Color.Green.ToArgb()),
                new PositionColored(new Vector3(0, 10, 0), Color.Green.ToArgb()) };
            PositionColored[] zAxis = new PositionColored[2] {
                new PositionColored(new Vector3(0), Color.Blue.ToArgb()),
                new PositionColored(new Vector3(0, 0, 10), Color.Blue.ToArgb()) };

            Device.SetRenderState(RenderState.ZEnable, ZBufferType.UseZBuffer);
            Device.SetRenderState(RenderState.VertexBlend, VertexBlend.Disable);
            Device.SetRenderState(RenderState.Lighting, false);
            Device.SetTransform(TransformState.World, Matrix.Identity);
            Device.VertexFormat = PositionColored.Format;
            Device.Material = Renderer.NullMaterial;
            Device.SetTexture(0, null);

            Device.DrawUserPrimitives(PrimitiveType.LineList, 1, xAxis);
            Device.DrawUserPrimitives(PrimitiveType.LineList, 1, yAxis);
            Device.DrawUserPrimitives(PrimitiveType.LineList, 1, zAxis);
        }