/// <summary> /// Creates a <see cref="T:DefaultVertex[]"/>. /// </summary> private DefaultVertex[] CreateDefaultVertexArray() { var geometry = (MeshGeometry3D)this.Geometry; var colors = geometry.Colors != null ? geometry.Colors.Array : null; var textureCoordinates = geometry.TextureCoordinates != null ? geometry.TextureCoordinates.Array : null; var texScale = this.TextureCoodScale; var normals = geometry.Normals != null ? geometry.Normals.Array : null; var tangents = geometry.Tangents != null ? geometry.Tangents.Array : null; var bitangents = geometry.BiTangents != null ? geometry.BiTangents.Array : null; var positions = geometry.Positions.Array; var vertexCount = geometry.Positions.Count; var result = new DefaultVertex[vertexCount]; for (var i = 0; i < vertexCount; i++) { result[i] = new DefaultVertex { Position = new Vector4(positions[i], 1f), Color = colors != null ? colors[i] : Color4.White, TexCoord = textureCoordinates != null ? texScale * textureCoordinates[i] : Vector2.Zero, Normal = normals != null ? normals[i] : Vector3.Zero, Tangent = tangents != null ? tangents[i] : Vector3.Zero, BiTangent = bitangents != null ? bitangents[i] : Vector3.Zero, }; } return(result); }
/// <summary> /// Creates a <see cref="T:DefaultVertex[]"/>. /// </summary> private DefaultVertex[] CreateDefaultVertexArray() { var geometry = (MeshGeometry3D)this.Geometry; var colors = geometry.Colors != null ? geometry.Colors.Array : null; var textureCoordinates = geometry.TextureCoordinates != null ? geometry.TextureCoordinates.Array : null; var texScale = this.TextureCoodScale; var normals = geometry.Normals != null ? geometry.Normals.Array : null; var tangents = geometry.Tangents != null ? geometry.Tangents.Array : null; var bitangents = geometry.BiTangents != null ? geometry.BiTangents.Array : null; var positions = geometry.Positions.Array; var vertexCount = geometry.Positions.Count; var result = new DefaultVertex[vertexCount]; for (var i = 0; i < vertexCount; i++) { result[i] = new DefaultVertex { Position = new Vector4(positions[i], 1f), Color = colors != null ? colors[i] : Color4.White, TexCoord = textureCoordinates != null ? texScale * textureCoordinates[i] : Vector2.Zero, Normal = normals != null ? normals[i] : Vector3.Zero, Tangent = tangents != null ? tangents[i] : Vector3.Zero, BiTangent = bitangents != null ? bitangents[i] : Vector3.Zero, }; } return result; }