Exemplo n.º 1
0
        internal void Build()
        {
            t.StartDrawingColoredQuads();
            Vector4 c   = entity.Color;
            Vector3 min = entity.AABB.Min;
            Vector3 max = entity.AABB.Max;

            Vector4[] v = new Vector4[] {
                new Vector4(min.X, min.Y, min.Z, 1),
                new Vector4(max.X, min.Y, min.Z, 1),
                new Vector4(max.X, min.Y, max.Z, 1),
                new Vector4(min.X, min.Y, max.Z, 1),
                new Vector4(min.X, max.Y, min.Z, 1),
                new Vector4(max.X, max.Y, min.Z, 1),
                new Vector4(max.X, max.Y, max.Z, 1),
                new Vector4(min.X, max.Y, max.Z, 1),
            };

            // left
            t.AddVertexWithColor(v[0], c);
            t.AddVertexWithColor(v[4], c);
            t.AddVertexWithColor(v[7], c);
            t.AddVertexWithColor(v[3], c);

            //front
            t.AddVertexWithColor(v[3], c);
            t.AddVertexWithColor(v[7], c);
            t.AddVertexWithColor(v[6], c);
            t.AddVertexWithColor(v[2], c);

            //right
            t.AddVertexWithColor(v[2], c);
            t.AddVertexWithColor(v[6], c);
            t.AddVertexWithColor(v[5], c);
            t.AddVertexWithColor(v[1], c);

            //back
            t.AddVertexWithColor(v[1], c);
            t.AddVertexWithColor(v[5], c);
            t.AddVertexWithColor(v[4], c);
            t.AddVertexWithColor(v[0], c);

            //top
            t.AddVertexWithColor(v[4], c);
            t.AddVertexWithColor(v[5], c);
            t.AddVertexWithColor(v[6], c);
            t.AddVertexWithColor(v[7], c);

            //bottom
            t.AddVertexWithColor(v[0], c);
            t.AddVertexWithColor(v[3], c);
            t.AddVertexWithColor(v[2], c);
            t.AddVertexWithColor(v[1], c);

            buffer = t.GetVertexBuffer();
        }
Exemplo n.º 2
0
        public HeadUpDisplay()
        {
            player = World.Instance.Player;

            for (int i = 0; i < labels.Length; i++)
            {
                labels[i]       = new Label();
                labels[i].Color = new Vector4(1f, 1f, 0.2f, 1);
            }

            t.StartDrawingColoredQuads();
            Vector4 Color1 = new Vector4(0.1f, 0.1f, 0.1f, 1);

            t.AddVertexWithColor(new Vector4(0, 0, 0f, 1f), Color1);
            t.AddVertexWithColor(new Vector4(0, 1, 0f, 1f), Color1);
            t.AddVertexWithColor(new Vector4(1, 1, 0f, 1f), Color1);
            t.AddVertexWithColor(new Vector4(1, 0, 0f, 1f), Color1);
            background = t.GetVertexBuffer();
        }