commit f127c7ed142605a2907095278fc61166ffb01767
parent 3bcab8fafd77f2d34a1ed353d21dbb5bf9b0102e
Author: Michael Savage <mikejsavage@gmail.com>
Date: Sat, 18 Nov 2017 17:54:20 +0200
Whoops - add the skirt shader again
Diffstat:
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/shaders/clipmap_skirt.glsl b/shaders/clipmap_skirt.glsl
@@ -10,7 +10,7 @@ layout( std140 ) uniform sun {
};
layout( std140 ) uniform clipmap_skirt {
- vec2 bounds[ 4 ];
+ float scale;
};
struct VSOut {
@@ -25,13 +25,9 @@ in vec3 position;
out VSOut v2f;
void main() {
- if( gl_VertexID < 4 ) {
- v2f.view_position = V * vec4( position, 1.0 );
- }
- else {
- vec2 p = bounds[ gl_VertexID - 4 ];
- v2f.view_position = V * vec4( p, 0.0, 1.0 );
- }
+ vec2 xy = position.xy + camera_pos.xy;
+ vec2 snapped_xy = floor( xy / scale ) * scale;
+ v2f.view_position = V * vec4( snapped_xy, 0.0, 1.0 );
gl_Position = P * v2f.view_position;
}