Use square tree textures with reduce UV coordinates.
|
@ -11,9 +11,10 @@ void main() {
|
||||||
|
|
||||||
// Texture coordinates
|
// Texture coordinates
|
||||||
float numVarieties = gl_Normal.z;
|
float numVarieties = gl_Normal.z;
|
||||||
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
|
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
|
||||||
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
|
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
|
||||||
gl_TexCoord[0] = vec4(texFract + 0.5 * float(season), gl_MultiTexCoord0.y, 0.0, 0.0);
|
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
|
||||||
|
gl_TexCoord[0].y = gl_TexCoord[0].y + 0.5 * season;
|
||||||
|
|
||||||
// Position and scaling
|
// Position and scaling
|
||||||
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
||||||
|
|
|
@ -75,17 +75,18 @@ void main()
|
||||||
// this code is copied from tree.vert
|
// this code is copied from tree.vert
|
||||||
|
|
||||||
float numVarieties = gl_Normal.z;
|
float numVarieties = gl_Normal.z;
|
||||||
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
|
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
|
||||||
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
|
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
|
||||||
|
|
||||||
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
|
// 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
|
// 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
|
// so that trees aren't all oriented N/S
|
||||||
float sr = sin(gl_FogCoord + gl_Color.x);
|
float sr = sin(gl_FogCoord + gl_Color.x);
|
||||||
float cr = cos(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);
|
||||||
|
|
||||||
// Shift texture to account for snow level and seasons
|
// Determine the y texture coordinate based on whether it's summer, winter, snowy.
|
||||||
gl_TexCoord[0] = vec4(texFract + 0.25 * step(snow_level, gl_Color.z) + 0.5 * float(season), gl_MultiTexCoord0.y, 0.0, 0.0);
|
gl_TexCoord[0].y = gl_TexCoord[0].y + 0.25 * step(snow_level, gl_Color.z) + 0.5 * season;
|
||||||
|
|
||||||
// scaling
|
// scaling
|
||||||
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
||||||
|
|
|
@ -17,15 +17,16 @@ uniform int season;
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
float numVarieties = gl_Normal.z;
|
float numVarieties = gl_Normal.z;
|
||||||
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
|
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / numVarieties;
|
||||||
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
|
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
|
||||||
|
|
||||||
// Determine the rotation for the tree. The Fog Coordinate provides rotation information
|
// 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
|
// 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
|
// so that trees aren't all oriented N/S
|
||||||
float sr = sin(gl_FogCoord + gl_Color.x);
|
float sr = sin(gl_FogCoord + gl_Color.x);
|
||||||
float cr = cos(gl_FogCoord + gl_Color.x);
|
float cr = cos(gl_FogCoord + gl_Color.x);
|
||||||
gl_TexCoord[0] = vec4(texFract + 0.5 * float(season), gl_MultiTexCoord0.y, 0.0, 0.0);
|
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
|
||||||
|
gl_TexCoord[0].y = gl_TexCoord[0].y + 0.5 * season;
|
||||||
|
|
||||||
// scaling
|
// scaling
|
||||||
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
||||||
|
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 284 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 101 KiB |