Exemple #1
0
        /// <summary>
        /// Draw a colored line.
        /// </summary>
        /// <param name="a">Vector A.</param>
        /// <param name="b">Vector B.</param>
        /// <param name="color">The color of the quad.</param>
        /// <param name="device">The direct3D device.</param>
        private void DrawLine(Vector3 a, Vector3 b, Color color, Device device)
        {
            LineVertex[] lineData = new LineVertex[2];

            lineData[0].Position = a;
            lineData[0].Color    = color.ToArgb();
            lineData[1].Position = b;
            lineData[1].Color    = color.ToArgb();

            device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;
            device.DrawUserPrimitives <LineVertex>(PrimitiveType.LineList, 0, lineData.Length / 2, lineData);
        }
Exemple #2
0
        /// <summary>
        /// Draw simple colored filled box.
        /// </summary>
        /// <param name="a">Vector A.</param>
        /// <param name="b">Vector B.</param>
        /// <param name="c">Vector C.</param>
        /// <param name="d">Vector D.</param>
        /// <param name="color">The color of the quad.</param>
        /// <param name="device">The direct3D device.</param>
        private void DrawBox(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Color color, Device device)
        {
            LineVertex[] lineData = new LineVertex[4];

            lineData[0].Position = a;
            lineData[0].Color    = color.ToArgb();
            lineData[1].Position = b;
            lineData[1].Color    = color.ToArgb();

            lineData[2].Position = c;
            lineData[2].Color    = color.ToArgb();
            lineData[3].Position = d;
            lineData[3].Color    = color.ToArgb();

            device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;
            device.DrawUserPrimitives <LineVertex>(PrimitiveType.TriangleFan, 0, lineData.Length / 2, lineData);
        }
        /// <summary>
        /// Draw a colored line.
        /// </summary>
        /// <param name="a">Vector A.</param>
        /// <param name="b">Vector B.</param>
        /// <param name="color">The color of the quad.</param>
        /// <param name="device">The direct3D device.</param>
        private void DrawLine(Vector3 a, Vector3 b, Color color, Device device)
        {
            LineVertex[] lineData = new LineVertex[2];

            lineData[0].Position = a;
            lineData[0].Color = color.ToArgb();
            lineData[1].Position = b;
            lineData[1].Color = color.ToArgb();

            device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;
            device.DrawUserPrimitives<LineVertex>(PrimitiveType.LineList, 0, lineData.Length / 2, lineData);
        }
        /// <summary>
        /// Draw simple colored filled box.
        /// </summary>
        /// <param name="a">Vector A.</param>
        /// <param name="b">Vector B.</param>
        /// <param name="c">Vector C.</param>
        /// <param name="d">Vector D.</param> 
        /// <param name="color">The color of the quad.</param>
        /// <param name="device">The direct3D device.</param>
        private void DrawBox(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Color color, Device device)
        {
            LineVertex[] lineData = new LineVertex[4];

            lineData[0].Position = a;
            lineData[0].Color = color.ToArgb();
            lineData[1].Position = b;
            lineData[1].Color = color.ToArgb();

            lineData[2].Position = c;
            lineData[2].Color = color.ToArgb();
            lineData[3].Position = d;
            lineData[3].Color = color.ToArgb();

            device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;
            device.DrawUserPrimitives<LineVertex>(PrimitiveType.TriangleFan, 0, lineData.Length / 2, lineData);
        }