Use square tree textures with reduce UV coordinates.
This commit is contained in:
parent
847e49b3a5
commit
3929e8d091
13 changed files with 15 additions and 12 deletions
|
@ -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;
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Before ![]() (image error) Size: 54 KiB After ![]() (image error) Size: 109 KiB ![]() ![]() |
Binary file not shown.
Binary file not shown.
Before ![]() (image error) Size: 63 KiB After ![]() (image error) Size: 89 KiB ![]() ![]() |
Binary file not shown.
Binary file not shown.
Before ![]() (image error) Size: 87 KiB After ![]() (image error) Size: 104 KiB ![]() ![]() |
Binary file not shown.
Binary file not shown.
Before ![]() (image error) Size: 81 KiB After ![]() (image error) Size: 284 KiB ![]() ![]() |
Binary file not shown.
Binary file not shown.
Before ![]() (image error) Size: 27 KiB After ![]() (image error) Size: 101 KiB ![]() ![]() |
Loading…
Add table
Reference in a new issue