Skip to content

Instantly share code, notes, and snippets.

@radical
Created November 23, 2013 20:14
Show Gist options
  • Save radical/7619367 to your computer and use it in GitHub Desktop.
Save radical/7619367 to your computer and use it in GitHub Desktop.
int index = 0;
for (int face_i = 0; face_i < VertIndicesForFaces.Count; face_i ++) {
var face = VertIndicesForFaces [face_i];
for (int vi = 0; vi < face.Length; vi ++) {
var v3d = new Vertex3d (vertices [face [vi]], Vector4f.Zero, c);
if (has_texcoords)
v3d.TexCoords = uv_coords [TexIndices [face_i][vi]];
e.Vertices.Add (v3d);
}
// add indices
for (int i = 0; i < face.Length - 2; i ++) {
e.Indices.Add (index);
e.Indices.Add (index + i + 1);
e.Indices.Add (index + i + 2);
}
index += face.Length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment