示例#1
0
        /// <summary>
        /// Creates a <see cref="T:PointsVertex[]"/>.
        /// </summary>
        private Geometry3D.PointsVertex[] CreateVertexArray()
        {
            var positions   = this.Geometry.Positions.Array;
            var vertexCount = this.Geometry.Positions.Count;
            var color       = this.Color;
            var result      = new Geometry3D.PointsVertex[vertexCount];

            if (this.Geometry.Colors != null && this.Geometry.Colors.Any())
            {
                var colors = this.Geometry.Colors;
                for (var i = 0; i < vertexCount; i++)
                {
                    result[i] = new Geometry3D.PointsVertex
                    {
                        Position = new Vector4(positions[i], 1f),
                        Color    = color * colors[i],
                    };
                }
            }
            else
            {
                for (var i = 0; i < vertexCount; i++)
                {
                    result[i] = new Geometry3D.PointsVertex
                    {
                        Position = new Vector4(positions[i], 1f),
                        Color    = color,
                    };
                }
            }

            return(result);
        }
        /// <summary>
        /// Creates a <see cref="T:PointsVertex[]"/>.
        /// </summary>
        private Geometry3D.PointsVertex[] CreatePointVertexArray()
        {
            var positions = this.Geometry.Positions.Array;
            var vertexCount = this.Geometry.Positions.Count;
            var color = this.Color;
            var result = new Geometry3D.PointsVertex[vertexCount];

            if (this.Geometry.Colors != null && this.Geometry.Colors.Any())
            {
                var colors = this.Geometry.Colors;
                for (var i = 0; i < vertexCount; i++)
                {
                    result[i] = new Geometry3D.PointsVertex
                    {
                        Position = new Vector4(positions[i], 1f),
                        Color = color * colors[i],
                    };
                }
            }
            else
            {
                for (var i = 0; i < vertexCount; i++)
                {
                    result[i] = new Geometry3D.PointsVertex
                    {
                        Position = new Vector4(positions[i], 1f),
                        Color = color,
                    };
                }
            }

            return result;
        }