http://bugs.winehq.org/show_bug.cgi?id=22918
--- Comment #14 from Misha Koshelev misha680@gmail.com 2010-07-16 14:35:36 --- Thank you for your comments. I have updated per all comments: http://github.com/misha680/wine/commit/e90ead51ca630485eb95204fb9e605b47585f...
except I do not quite understand: Also, note that you can easily define a helper function to generate a ring of vertices with a certain radius, z position and z normal.
Or rather, in the new code, the inner loop looks like this:
/* side - iterate over stacks (z axis) and slices (x/y axes around circle) */ for (stack=0;stack<=stacks;stack++) { 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 = vertex_data[vertex].position.x; vertex_data[vertex].normal.y = vertex_data[vertex].position.y; vertex_data[vertex].normal.z = radius * delta_radius / length;
D3DXVec3Normalize(&vertex_data[vertex].normal,&vertex_data[vertex].normal); vertex++; theta += theta_step; } if (stack<stacks) { z += z_step; radius -= radius_step; } }
However, the cap calculations are dfferent wrt normals:
/* 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?
Thank you Misha