Commit 90b6be6e authored by Taddeüs Kroes's avatar Taddeüs Kroes

Graphics assignment 10

Added one last piece of comment
parent 30a5da0e
...@@ -165,6 +165,10 @@ createCylinder(polys * list, double radius, double height, ...@@ -165,6 +165,10 @@ createCylinder(polys * list, double radius, double height,
double len; double len;
poly p; poly p;
int i; int i;
// Calculate the vertical component of the texture coordinate, take the
// radius of the cylinder into account while doing this to prevent
// stretching
GLfloat tex_height = (GLfloat)(height / (2 * M_PI * radius)); GLfloat tex_height = (GLfloat)(height / (2 * M_PI * radius));
// prepare poly datastructure, as these values are the same for all generated polys // prepare poly datastructure, as these values are the same for all generated polys
...@@ -198,7 +202,7 @@ createCylinder(polys * list, double radius, double height, ...@@ -198,7 +202,7 @@ createCylinder(polys * list, double radius, double height,
p.normal[i].x /= len; p.normal[i].x /= len;
p.normal[i].z /= len; p.normal[i].z /= len;
// Set texture coordinate/ // Set texture coordinate
p.tcoord[i].x = (i < 2 ? longitude : longitude+10) / 360.0; p.tcoord[i].x = (i < 2 ? longitude : longitude+10) / 360.0;
p.tcoord[i].y = (i == 1 || i == 2) ? tex_height : 0.0; p.tcoord[i].y = (i == 1 || i == 2) ? tex_height : 0.0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment