medfall

A super great game engine
Log | Files | Refs

commit 9a049dbb62c49ee25a4daae735bdf692d8b564d4
parent 9380c5e9779ddf47bdb2de06a53658702f1da846
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun Jul  2 21:47:59 +0300

Fix terrain uvs

Diffstat:
shaders/terrain.glsl | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/shaders/terrain.glsl b/shaders/terrain.glsl @@ -38,8 +38,10 @@ uniform samplerBuffer point_light_origins; uniform samplerBuffer point_light_colours; void main() { - vec3 normal = normalize( texture( normals, v2f.world_position.xy / dimensions ).xyz ); - float horizon = texture( horizons, v2f.world_position.xy / dimensions ).r; + vec2 world_pos = mod( v2f.world_position.xy, textureSize( normals, 0 ) - ivec2( 1, 1 ) ); + + vec3 normal = normalize( texture( normals, world_pos / textureSize( normals, 0 ) ).xyz ); + float horizon = texture( horizons, world_pos / textureSize( horizons, 0 ) ).r; // ground colour vec3 ground;