public void generateVBO() { lock (model) { List <Vertice> verts = model.getAllVertices(); List <TextureCoordinate> tcors = model.getAllTextureCoordinates(); this.vSize = verts.Count; this.tSize = tcors.Count; if (this.vSize < 1) { return; } float[] vertices = new float[this.vSize * 3]; for (int i = 0; i < this.vSize; i++) { Vertice v = verts[i]; int j = i * 3; vertices[j + 0] = (float)v.getX(); vertices[j + 1] = (float)v.getY(); vertices[j + 2] = (float)v.getZ(); } float[] coords = new float[this.tSize * 2]; for (int i = 0; i < this.tSize; i++) { TextureCoordinate t = tcors[i]; int j = i * 2; coords[j + 0] = (float)t.getX(); coords[j + 1] = (float)t.getY(); } this.vb = new VertexBuffer(this.vSize, VertexFormat.Float3, VertexFormat.Float2); lock (this.vb) { this.vb.SetVertices(0, vertices); if (this.vSize == this.tSize) { this.vb.SetVertices(1, coords); } } } }
public Location(Vertice v) : this(v.getX(), v.getY(), v.getZ()) { }