Exemple #1
0
        void InitializePlanes(GraphicsDevice graphicsDevice, int gridSize, float cellSize, Color color)
        {
            int   halfGridSize = gridSize / 2;
            float offset       = halfGridSize * cellSize;

            var upTransform = Matrix.CreateTranslation(new Vector3(0, offset, 0));

            Up = GridPlane.CreatePlaneXZ(graphicsDevice, gridSize, gridSize, cellSize, color, upTransform);

            var downTransform = Matrix.CreateTranslation(new Vector3(0, -offset, 0));

            Down = GridPlane.CreatePlaneXZ(graphicsDevice, gridSize, gridSize, cellSize, color, downTransform);

            var forwardTransform = Matrix.CreateTranslation(new Vector3(0, 0, -offset));

            Forward = GridPlane.CreatePlaneXY(graphicsDevice, gridSize, gridSize, cellSize, color, forwardTransform);

            var backwardTransform = Matrix.CreateTranslation(new Vector3(0, 0, offset));

            Backward = GridPlane.CreatePlaneXY(graphicsDevice, gridSize, gridSize, cellSize, color, backwardTransform);

            var leftTransform = Matrix.CreateTranslation(new Vector3(-offset, 0, 0));

            Left = GridPlane.CreatePlaneZY(graphicsDevice, gridSize, gridSize, cellSize, color, leftTransform);

            var rightTransform = Matrix.CreateTranslation(new Vector3(offset, 0, 0));

            Right = GridPlane.CreatePlaneZY(graphicsDevice, gridSize, gridSize, cellSize, color, rightTransform);
        }