Пример #1
0
        public override void Render()
        {
            driver.SetTransform(TransformationState.World, AbsoluteTransformation);
            // Figure out quads based on start/end points.
            Matrix4 m = new Matrix4();
            m.RotationDegrees = getTargetAngle(vStart, vEnd);
            Vector3D vUp = new Vector3D(0, 1, 0);
            Vector3D vRight = new Vector3D(-1, 0, 0);
            m.TransformVect(ref vRight);
            m.TransformVect(ref vUp);

            // Draw the first cross
            IrrQuad beam = new IrrQuad();
            beam.verts[0] = new Vertex3D(vStart + vUp * flScale, new Vector3D(1, 1, 0), beamColor, new Vector2D(0, 1));
            beam.verts[1] = new Vertex3D(vStart + vUp * -flScale, new Vector3D(1, 0, 0), beamColor, new Vector2D(1, 1));
            beam.verts[2] = new Vertex3D(vEnd + vUp * -flScale, new Vector3D(0, 1, 1), beamColor, new Vector2D(1, 0));
            beam.verts[3] = new Vertex3D(vEnd + vUp * flScale, new Vector3D(0, 0, 1), beamColor, new Vector2D(0, 0));
            DrawQuad(beam);

            // Draw the second cross.
            beam.verts[0] = new Vertex3D(vStart + vRight * flScale, new Vector3D(1, 1, 0), beamColor, new Vector2D(0, 1));
            beam.verts[1] = new Vertex3D(vStart + vRight * -flScale, new Vector3D(1, 0, 0), beamColor, new Vector2D(1, 1));
            beam.verts[2] = new Vertex3D(vEnd + vRight * -flScale, new Vector3D(0, 1, 1), beamColor, new Vector2D(1, 0));
            beam.verts[3] = new Vertex3D(vEnd + vRight * flScale, new Vector3D(0, 0, 1), beamColor, new Vector2D(0, 0));
            DrawQuad(beam);

            if (DebugDataVisible == DebugSceneType.BoundingBox)
                driver.Draw3DBox(BoundingBox, Color.White);
        }
Пример #2
0
 void DrawQuad(IrrQuad quad)
 {
     driver.SetMaterial(Material);
     driver.DrawIndexedTriangleList(quad.verts, 4, indices, 4);
 }