Ejemplo n.º 1
0
        private BillboardVertex[] CreateBillboardVertexArray()
        {
            var billboardGeometry = Geometry as IBillboardText;

            // Gather all of the textInfo offsets.
            // These should be equal in number to the positions.

            billboardGeometry.DrawText();

            var position    = billboardGeometry.Positions.Array;
            var vertexCount = billboardGeometry.Positions.Count;
            var result      = new BillboardVertex[vertexCount];

            var allOffsets = billboardGeometry.TextInfoOffsets;

            for (var i = 0; i < vertexCount; i++)
            {
                var tc = billboardGeometry.TextureCoordinates[i];
                result[i] = new BillboardVertex
                {
                    Position = new Vector4(position[i], 1.0f),
                    Color    = billboardGeometry.Colors[i],
                    TexCoord = new Vector4(tc.X, tc.Y, allOffsets[i].X, allOffsets[i].Y)
                };
            }

            return(result.ToArray());
        }
Ejemplo n.º 2
0
        private BillboardVertex[] CreateBillboardVertexArray()
        {
            var billboardGeometry = Geometry as BillboardText3D;

            // Gather all of the textInfo offsets.
            // These should be equal in number to the positions.
            foreach (var ti in billboardGeometry.TextInfo)
            {
                billboardGeometry.DrawText(ti);
            }

            var position    = billboardGeometry.Positions.Array;
            var vertexCount = billboardGeometry.Positions.Count;
            var result      = new List <BillboardVertex>();

            var allOffsets = billboardGeometry.TextInfo.SelectMany(ti => ti.Offsets).ToArray();

            for (var i = 0; i < vertexCount; i++)
            {
                var tc  = billboardGeometry.TextureCoordinates[i];
                var vtx = new BillboardVertex
                {
                    Position = new Vector4(position[i], 1.0f),
                    Color    = billboardGeometry.Colors[i],
                    TexCoord = new Vector4(tc.X, tc.Y, allOffsets[i].X, allOffsets[i].Y)
                };

                result.Add(vtx);
            }

            return(result.ToArray());
        }
Ejemplo n.º 3
0
        private BillboardVertex[] CreateBillboardVertexArray()
        {
            var billboardGeometry = Geometry as BillboardText3D;

            // Gather all of the textInfo offsets.
            // These should be equal in number to the positions.
            foreach (var ti in billboardGeometry.TextInfo)
            {
                billboardGeometry.DrawText(ti);
            }

            var position = billboardGeometry.Positions.Array;
            var vertexCount = billboardGeometry.Positions.Count;
            var result = new List<BillboardVertex>();

            var allOffsets = billboardGeometry.TextInfo.SelectMany(ti => ti.Offsets).ToArray();

            for (var i = 0; i < vertexCount; i++)
            {
                var tc = billboardGeometry.TextureCoordinates[i];
                var vtx = new BillboardVertex
                {
                    Position = new Vector4(position[i], 1.0f),
                    Color = billboardGeometry.Colors[i],
                    TexCoord = new Vector4(tc.X,tc.Y, allOffsets[i].X, allOffsets[i].Y)
                };

                result.Add(vtx);
            }

            return result.ToArray();
        }