http://bugs.winehq.org/show_bug.cgi?id=22918
--- Comment #15 from Henri Verbeet hverbeet@gmail.com 2010-07-16 15:29:49 --- (In reply to comment #14)
/* top cap */ theta = M_PI / 2; for (slice=0;slice<slices;slice++) { vertex_data[vertex].position.x = radius*cos(theta); vertex_data[vertex].position.y = radius*sin(theta); vertex_data[vertex].position.z = z; vertex_data[vertex].normal.x = 0.0f; vertex_data[vertex].normal.y = 0.0f; vertex_data[vertex].normal.z = -1.0f; vertex++; theta += theta_step; }
Thus, it seems that if I made a helper function, it would only be useful in the main loop and not the cap calculations... or am I missing something?
No, you're right, the x and y components of the normal are 0.0f for the caps. You could still have separate helper functions for the main loop and caps, and perhaps you can share some code with spheres, but that's probably less interesting at this point.