Created
May 9, 2013 19:59
-
-
Save timothyhahn/5550144 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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