internal void TestBoxGeneration()
        {
            int count = WireframeBoxVertexGenerator.VertexCount;

            VertexPositionColor[] vertices = new VertexPositionColor[count + 1];

            WireframeBoxVertexGenerator.Generate(
                vertices, 1,
                new Vector3(10.0f, 20.0f, 30.0f), new Vector3(20.0f, 25.0f, 32.5f),
                Color.Blue
                );

            Assert.AreEqual(Vector3.Zero, vertices[0].Position);
            Assert.AreNotEqual(Vector3.Zero, vertices[1].Position);
            Assert.AreNotEqual(Vector3.Zero, vertices[count - 1].Position);
        }
Esempio n. 2
0
        /// <summary>Draws a wireframe box at the specified location</summary>
        /// <param name="min">Contains the coordinates of the box lesser corner</param>
        /// <param name="max">Contains the coordinates of the box greater corner</param>
        /// <param name="color">Color of the wireframe to draw</param>
        public void DrawBox(Vector3 min, Vector3 max, Color color)
        {
            const int VertexCount = WireframeBoxVertexGenerator.VertexCount;

            // If we would collide with the triangles in the array or there simply
            // isn't enough space left, set the overflow flag and silently skip drawing
            int proposedStart = this.lineIndex - (VertexCount - 1);

            if (proposedStart < this.triangleIndex)
            {
                this.overflowed = true;
                return;
            }

            // Generate the vertices for box' wireframe
            WireframeBoxVertexGenerator.Generate(
                this.queuedVertices, proposedStart, min, max, color
                );

            this.lineIndex -= VertexCount;
        }