Esempio n. 1
0
        //-----------------------
        void DrawWireframeTri(Engine engine, Matrix mat, Vector3 p0, Vector3 p1, Vector3 p2,
                              Bootstrap.Color c0, Bootstrap.Color c1, Bootstrap.Color c2)
        {
            p0 = mat.TransformCoord(p0);
            p1 = mat.TransformCoord(p1);
            p2 = mat.TransformCoord(p2);

            engine.DrawLine(p0, p1, c0);
            engine.DrawLine(p1, p2, c1);
            engine.DrawLine(p2, p0, c2);
        }
Esempio n. 2
0
        //-----------------------
        // UI rendering.
        public void Render()
        {
            Engine engine = Program.GameEngine;

            float  width  = 0.5f * _maskCamera.Projection.Width;
            float  height = 0.5f * _maskCamera.Projection.Height;
            Matrix world  = new Matrix(_maskCamera.Rotation, _maskCamera.Position);

            Bootstrap.Color red    = new Bootstrap.Color(1.0f, 0.0f, 0.0f, 1.0f);
            Bootstrap.Color green  = new Bootstrap.Color(0.0f, 1.0f, 0.0f, 1.0f);
            Bootstrap.Color blue   = new Bootstrap.Color(0.0f, 0.0f, 1.0f, 1.0f);
            Bootstrap.Color yellow = new Bootstrap.Color(1.0f, 1.0f, 0.0f, 1.0f);
            Bootstrap.Color teal   = new Bootstrap.Color(0.0f, 1.0f, 1.0f, 0.0f);

            // bottom.
            DrawWireframeTri(engine, world,
                             new Vector3(0.0f, 0.0f, 0.0f),
                             new Vector3(-width, -height, -1.0f),
                             new Vector3(width, height, -1.0f),
                             green, green, green);

            // left.
            DrawWireframeTri(engine, world,
                             new Vector3(0.0f, 0.0f, 0.0f),
                             new Vector3(-width, -height, -1.0f),
                             new Vector3(-width, height, -1.0f),
                             green, green, green);

            // top.
            DrawWireframeTri(engine, world,
                             new Vector3(0.0f, 0.0f, 0.0f),
                             new Vector3(width, height, -1.0f),
                             new Vector3(-width, height, -1.0f),
                             green, yellow, yellow);

            // right.
            DrawWireframeTri(engine, world,
                             new Vector3(0.0f, 0.0f, 0.0f),
                             new Vector3(width, height, -1.0f),
                             new Vector3(width, -height, -1.0f),
                             green, teal, teal);
        }