示例#1
0
        public void Render(GameTime gameTime)
        {
            Color xzColor = (ActivePlane == CurrentActivePlane.XZ) ? Color.OrangeRed : Color.DarkGray;
            Color yzColor = (ActivePlane == CurrentActivePlane.YZ) ? Color.CadetBlue : Color.DarkGray;
            Color xyColor = (ActivePlane == CurrentActivePlane.XY) ? Color.DarkGreen : Color.DarkGray;


            if (RenderGrid)
            {
                for (float i = -modellingAreaSize / 2; i <= modellingAreaSize / 2; i++)
                {
                    if (RenderActivePlaneOnly && i == CurrentZIndex)
                    {
                        DebugShapeRenderer.AddXYGrid(new Vector3(-modellingAreaSize / 2, -modellingAreaSize / 2, i),
                                                     modellingAreaSize,
                                                     modellingAreaSize, 1, (i == CurrentZIndex) ? xyColor : Color.DarkGray);
                    }


                    if (RenderActivePlaneOnly && i == CurrentYIndex)
                    {
                        DebugShapeRenderer.AddXZGrid(new Vector3(-modellingAreaSize / 2, i, -modellingAreaSize / 2),
                                                     modellingAreaSize,
                                                     modellingAreaSize, 1, (i == CurrentYIndex) ? xzColor : Color.DarkGray);
                    }

                    if (RenderActivePlaneOnly && i == CurrentXIndex)
                    {
                        DebugShapeRenderer.AddYZGrid(new Vector3(i, -modellingAreaSize / 2, -modellingAreaSize / 2),
                                                     modellingAreaSize, modellingAreaSize, 1,
                                                     (i == CurrentXIndex) ? yzColor : Color.DarkGray);
                    }
                }
            }


            if (CurrentMode == EditMode.Vertex)
            {
                if (currentVertices.Count > 0)
                {
                    for (int i = 0; i < currentVertices.Count - 1; i++)
                    {
                        DebugShapeRenderer.AddLine(currentVertices[i], currentVertices[i + 1], currentColour);
                    }
                    DebugShapeRenderer.AddLine(currentVertices[currentVertices.Count - 1], currentbuildPoint, currentColour);
                }
            }
        }