Esempio n. 1
0
        public void Render(double delta)
        {
            if (!game.ShowAxisLines)
            {
                return;
            }
            if (vertices == null)
            {
                vertices = new VertexP3fC4b[12];
                vb       = game.Graphics.CreateDynamicVb(VertexFormat.P3fC4b, vertices.Length);
            }
            game.Graphics.Texturing = false;
            Vector3 P     = game.LocalPlayer.Position; P.Y += 0.05f;
            int     index = 0;

            SelectionBox.HorQuad(vertices, ref index, FastColour.Red.Pack(),
                                 P.X, P.Z - size, P.X + 3, P.Z + size, P.Y);
            SelectionBox.HorQuad(vertices, ref index, FastColour.Blue.Pack(),
                                 P.X - size, P.Z, P.X + size, P.Z + 3, P.Y);
            if (game.Camera.IsThirdPerson)
            {
                SelectionBox.VerQuad(vertices, ref index, FastColour.Green.Pack(),
                                     P.X - size, P.Y, P.Z + size, P.X + size, P.Y + 3, P.Z - size);
            }

            game.Graphics.SetBatchFormat(VertexFormat.P3fC4b);
            game.Graphics.UpdateDynamicIndexedVb(DrawMode.Triangles, vb, vertices, index);
        }
        public void Render(double delta)
        {
            if (!game.ShowAxisLines || game.Graphics.LostContext)
            {
                return;
            }
            if (vertices == null)
            {
                vertices = new VertexP3fC4b[12];
                ContextRecreated();
            }
            game.Graphics.Texturing = false;
            Vector3 P     = game.LocalPlayer.Position; P.Y += 0.05f;
            int     index = 0;

            SelectionBox.HorQuad(vertices, ref index, PackedCol.Red,
                                 P.X, P.Z - size, P.X + 3, P.Z + size, P.Y);
            SelectionBox.HorQuad(vertices, ref index, PackedCol.Blue,
                                 P.X - size, P.Z, P.X + size, P.Z + 3, P.Y);
            if (game.Camera.IsThirdPerson)
            {
                SelectionBox.VerQuad(vertices, ref index, PackedCol.Green,
                                     P.X - size, P.Y, P.Z + size, P.X + size, P.Y + 3, P.Z - size);
            }

            game.Graphics.SetBatchFormat(VertexFormat.P3fC4b);
            game.Graphics.UpdateDynamicVb_IndexedTris(vb, vertices, index);
        }