public void Upload(IMesh newMesh) { if (newMesh is Mesh <TVertex> ) { Mesh <TVertex> theMesh = newMesh as Mesh <TVertex>; vertices = theMesh.vertices; numVertices = theMesh.Length; vertexFormat = theMesh.VertexFormat; uploaded = false; // Vertex format has to stay the same, no need to change attrib array } }
public VertexArray(VertexBuffer <TVertex> vertexBuffer, Shader shader, VertexFormat vertexFormat) { // Construct array of VertexAttribute from vertex format: List <VertexAttribute> attrs = new List <VertexAttribute>(); foreach (var attr in vertexFormat.Attributes) { attrs.Add(new VertexAttribute(attr.Name, VertexFormat.NumberOfFloatsInType(attr.Type), VertexAttribPointerType.Float, vertexFormat.size, attr.Offset)); } Initialize(vertexBuffer, shader, attrs.ToArray()); }
public Mesh(TVertex[] vertices) { this.vertexFormat = vertices[0].GetVertexFormat(); this.vertices = vertices; }