Пример #1
0
 public static void DrawRect(GUILayer.SimpleRenderingContext context, Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(context, PrimitiveType.LineList,
                              s_linesVertId,
                              s_rectStartVertex,
                              s_rectVertexCount,
                              color,
                              xform);
 }
Пример #2
0
 public static void DrawPivot(GUILayer.SimpleRenderingContext context, Matrix4F xform, Color c)
 {
     GameEngine.DrawPrimitive(context, PrimitiveType.LineStrip,
                              s_pivotVerts,
                              0,
                              s_pivotVertexCount,
                              c,
                              xform);
 }
Пример #3
0
 public static void DrawCircle(GUILayer.SimpleRenderingContext context, Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(context, PrimitiveType.LineStrip,
                              s_circleVerts,
                              0,
                              s_circleVertexCount,
                              color,
                              xform);
 }
Пример #4
0
 public static void DrawRect(Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineList,
                              s_linesVertId,
                              s_rectStartVertex,
                              s_rectVertexCount,
                              color,
                              xform);
 }
Пример #5
0
 public static void DrawZ(GUILayer.SimpleRenderingContext context, Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(context, PrimitiveType.LineList,
                              s_linesVertId,
                              s_axisStartVertex + 4,
                              2,
                              color,
                              xform);
 }
Пример #6
0
 public static void DrawUnitSquare(Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineList,
                              s_linesVertId,
                              s_unitSquareStartVertex,
                              s_unitSquareVertexCount,
                              color,
                              xform);
 }
Пример #7
0
 public static void DrawCircle(Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineStrip,
                              s_circleVerts,
                              0,
                              s_circleVertexCount,
                              color,
                              xform);
 }
Пример #8
0
 public static void DrawPivot(Matrix4F xform, Color c)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineStrip,
                              s_pivotVerts,
                              0,
                              s_pivotVertexCount,
                              c,
                              xform);
 }
Пример #9
0
 public static void DrawZ(Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineList,
                              s_linesVertId,
                              s_axisStartVertex + 4,
                              2,
                              color,
                              xform);
 }
Пример #10
0
 //public static void DrawLine()
 public static void DrawAxis(Matrix4F xform, Color color)
 {
     GameEngine.DrawPrimitive(PrimitiveType.LineList,
                              s_linesVertId,
                              s_axisStartVertex,
                              s_axisVertexCount,
                              color,
                              xform,
                              RenderFlag
                              );
 }
Пример #11
0
        public void Render(Camera cam)
        {
            GameEngine.SetRendererFlag(BasicRendererFlags.WireFrame);
            IGrid grid = this.As <IGrid>();

            if (grid.Visible == false)
            {
                return;
            }

            float s = grid.Size;

            Matrix4F scale = new Matrix4F();

            scale.Scale(new Vec3F(s, s, s));

            Matrix4F gridXform = new Matrix4F();

            if (cam.Frustum.IsOrtho)
            {
                float     dist = cam.ViewMatrix.Translation.Z;
                ViewTypes vt   = cam.ViewType;
                if (vt == ViewTypes.Top)
                {
                    gridXform.Translation
                        = new Vec3F(0, dist, 0);
                }
                else if (vt == ViewTypes.Bottom)
                {
                    gridXform.Translation
                        = new Vec3F(0, -dist, 0);
                }
                else if (vt == ViewTypes.Right)
                {
                    gridXform.RotZ(MathHelper.PiOver2);
                    gridXform.Translation
                        = new Vec3F(dist, 0, 0);
                }
                else if (vt == ViewTypes.Left)
                {
                    gridXform.RotZ(MathHelper.PiOver2);
                    gridXform.Translation
                        = new Vec3F(-dist, 0, 0);
                }
                else if (vt == ViewTypes.Front)
                {
                    gridXform.RotX(MathHelper.PiOver2);
                    gridXform.Translation
                        = new Vec3F(0, 0, dist);
                }
                else if (vt == ViewTypes.Back)
                {
                    gridXform.RotX(MathHelper.PiOver2);
                    gridXform.Translation
                        = new Vec3F(0, 0, -dist);
                }
                gridXform.Mul(scale, gridXform);
            }
            else
            {
                Matrix4F trans = new Matrix4F();
                trans.Translation = new Vec3F(0, grid.Height, 0);
                gridXform         = Matrix4F.Multiply(scale, trans);
            }

            GameEngine.DrawPrimitive(PrimitiveType.LineList, m_gridVBId, 0, m_gridVertexCount, Color.LightGray,
                                     gridXform);
        }