public void TestArrowGeneration() { int count = SolidArrowVertexGenerator.VertexCount; VertexPositionColor[] vertices = new VertexPositionColor[count + 1]; SolidArrowVertexGenerator.Generate( vertices, 1, new Vector3(10.0f, 20.0f, 30.0f), Vector3.Forward, Color.Blue ); Assert.AreEqual(Vector3.Zero, vertices[0].Position); Assert.AreNotEqual(Vector3.Zero, vertices[1].Position); Assert.AreNotEqual(Vector3.Zero, vertices[count - 1].Position); }
/// <summary>Draws a solid arrow into the scene to visualize a vector</summary> /// <param name="origin"> /// Location at which to draw the arrow (this will form the exact center of /// the drawn arrow's base) /// </param> /// <param name="direction"> /// Direction the arrow is pointing into. The arrow's size is relative to /// the length of this vector. /// </param> /// <param name="color">Color of the arrow</param> public void DrawSolidArrow(Vector3 origin, Vector3 direction, Color color) { const int VertexCount = SolidArrowVertexGenerator.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 proposedEnd = this.triangleIndex + VertexCount; if (proposedEnd > this.lineIndex) { this.overflowed = true; return; } // Generate the vertices for the faces of the box SolidArrowVertexGenerator.Generate( this.queuedVertices, this.triangleIndex, origin, direction, color ); this.triangleIndex += VertexCount; }