Ejemplo n.º 1
0
        void CreateTriBillboard(Vector3 position, float radius, Color4 color, float angle, Vector2 texA, Vector2 texB, Vector2 texC)
        {
            /* Create triangle points */
            var rOn2 = radius * 0.5f;             //this should be much faster than division
            var rOn4 = radius * 0.25f;
            var ptC  = new Vector3(0, -(rOn2), angle);
            var ptB  = new Vector3(-rOn2 * sin120, -rOn2 * cos120, angle);
            var ptA  = new Vector3(-rOn4 * sin240, -rOn4 * cos240, angle);             //triangle is half as tall as it is wide

            verticesBasic [vertexCountBasic++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = texA,
                Dimensions        = ptA
            };

            verticesBasic [vertexCountBasic++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = texB,
                Dimensions        = ptB
            };

            verticesBasic [vertexCountBasic++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = texC,
                Dimensions        = ptC
            };
        }
Ejemplo n.º 2
0
        void CreateBillboard(Vector3 position, Vector2 size, Color4 color, float angle, Vector2 topleft, Vector2 topright, Vector2 bottomleft, Vector2 bottomright, Vector3 src_right, Vector3 src_up)
        {
            var sz1 = new Vector3(size.X * -0.5f, size.Y * -0.5f, angle);
            var sz2 = new Vector3(size.X * 0.5f, size.Y * -0.5f, angle);
            var sz3 = new Vector3(size.X * -0.5f, size.Y * 0.5f, angle);
            var sz4 = new Vector3(size.X * 0.5f, size.Y * 0.5f, angle);

            vertices[vertexCount++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = bottomleft,
                Dimensions        = sz1,
                Right             = src_right,
                Up = src_up
            };
            vertices[vertexCount++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = topleft,
                Dimensions        = sz2,
                Right             = src_right,
                Up = src_up
            };
            vertices[vertexCount++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = bottomright,
                Dimensions        = sz3,
                Right             = src_right,
                Up = src_up
            };
            vertices[vertexCount++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = topright,
                Dimensions        = sz4,
                Right             = src_right,
                Up = src_up
            };
        }
Ejemplo n.º 3
0
        void CreateBillboard(Vector3 position, Vector2 size, Color4 color, float angle, Vector2 topleft, Vector2 topright, Vector2 bottomleft, Vector2 bottomright)
        {
            var sz1 = new Vector3(size.X * -0.5f, size.Y * -0.5f, angle);
            var sz2 = new Vector3(size.X * 0.5f, size.Y * -0.5f, angle);
            var sz3 = new Vector3(size.X * -0.5f, size.Y * 0.5f, angle);
            var sz4 = new Vector3(size.X * 0.5f, size.Y * 0.5f, angle);

            verticesBasic[vertexCountBasic++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = bottomleft,
                Dimensions        = sz1
            };
            verticesBasic[vertexCountBasic++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = topleft,
                Dimensions        = sz2
            };
            verticesBasic[vertexCountBasic++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = bottomright,
                Dimensions        = sz3
            };
            verticesBasic[vertexCountBasic++] = new BillboardVert()
            {
                Position          = position,
                Color             = color,
                TextureCoordinate = topright,
                Dimensions        = sz4
            };
        }