Skip to content

Instantly share code, notes, and snippets.

@timothyhahn timothyhahn/scratch
Created May 9, 2013

Embed
What would you like to do?
faces == the "fs"
for(unsigned int i = 0; i < faces.size(); i += 3){
int index = faces[i];
vec4 vertex = vertices[index - 1];
vec4 a = vertex;
out_vertices.push_back(vertex);
index = faces[i + 1];
vertex = vertices[index - 1];
vec4 b = vertex;
out_vertices.push_back(vertex);
index = faces[i + 2];
vertex = vertices[index - 1];
vec4 c = vertex;
out_vertices.push_back(vertex);
vec3 norm = normalize(cross(b - a, c - b));
normals.push_back(norm);
normals.push_back(norm);
normals.push_back(norm);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.