1
0
Fork 0

Add an additional random rotation to trees so the quads are not

all oriented N/S and E/W, helping to disguise the limited set of
textures used.
This commit is contained in:
Stuart Buchanan 2012-07-24 22:12:11 +01:00
parent 05365279c1
commit 0604e3975b

View file

@ -18,8 +18,12 @@ void main(void)
float numVarieties = gl_Normal.z;
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
float sr = sin(gl_FogCoord);
float cr = cos(gl_FogCoord);
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
// to rotate one of the quands by 90 degrees. We then apply an additional position seed
// so that trees aren't all oriented N/S
float sr = sin(gl_FogCoord + gl_Color.x);
float cr = cos(gl_FogCoord + gl_Color.x);
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
// scaling