Change tree texture format from a 8x4 block to 32x1 to avoid UV bleeding problems.
|
@ -11,10 +11,9 @@ 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;
|
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
|
||||||
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
|
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
|
||||||
gl_TexCoord[0] = vec4(texFract, gl_MultiTexCoord0.y, 0.0, 0.0);
|
gl_TexCoord[0] = vec4(texFract + 0.5 * season, 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,18 +75,17 @@ 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;
|
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
|
||||||
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
|
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
// Determine the y texture coordinate based on whether it's summer, winter, snowy.
|
// Shift texture to account for snow level and seasons
|
||||||
gl_TexCoord[0].y = gl_TexCoord[0].y + 0.25 * int(gl_Color.z > snow_level) + 0.5 * season;
|
gl_TexCoord[0] = vec4(texFract + 0.25 * int(gl_Color.z > snow_level) + 0.5 * season, gl_MultiTexCoord0.y, 0.0, 0.0);
|
||||||
|
|
||||||
// scaling
|
// scaling
|
||||||
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
vec3 position = gl_Vertex.xyz * gl_Normal.xxy;
|
||||||
|
|
|
@ -17,16 +17,15 @@ 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;
|
float texFract = floor(fract(gl_MultiTexCoord0.x) * numVarieties) / (numVarieties * 4.0);
|
||||||
texFract += floor(gl_MultiTexCoord0.x) / numVarieties;
|
texFract += floor(gl_MultiTexCoord0.x) / (numVarieties * 4.0);
|
||||||
|
|
||||||
// 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);
|
gl_TexCoord[0] = vec4(texFract + 0.5 * season, 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: 102 KiB After Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 94 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 75 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 26 KiB |