]> git.tdb.fi Git - r2c2.git/commitdiff
Fix some minor shader errors
authorMikko Rasa <tdb@tdb.fi>
Tue, 7 Apr 2015 12:18:17 +0000 (15:18 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 7 Apr 2015 12:18:17 +0000 (15:18 +0300)
data/r2c2/sky.shader

index 2c7628a6f22937ec87b0f4a14faf71996ebce981..529050e93f9fd50a68c2f073d0d17b4173ca4559 100644 (file)
@@ -2,7 +2,7 @@ vertex_shader "
        varying vec3 eye_look_dir;
        void main()
        {
-               vec4 eye_pos = vec4(mat3(gl_ModelViewMatrix)*gl_Vertex.xyz, 1);
+               vec4 eye_pos = vec4((gl_ModelViewMatrix*vec4(gl_Vertex.xyz, 0.0)).xyz, 1.0);
                gl_Position = gl_ProjectionMatrix*eye_pos;
                eye_look_dir = eye_pos.xyz;
        }";
@@ -25,14 +25,14 @@ fragment_shader "
                if(c<0.0031308)
                        return 12.92*c;
                else
-                       return (1.055)*pow(c, 1.0/2.4)-0.055;
+                       return 1.055*pow(c, 1.0/2.4)-0.055;
        }
        void main()
        {
                vec3 n_eye_look_dir = normalize(eye_look_dir);
                vec3 n_eye_sun_dir = normalize(gl_LightSource[0].position.xyz);
 
-               if(dot(n_eye_look_dir, eye_sky_dir)>0)
+               if(dot(n_eye_look_dir, eye_sky_dir)>0.0)
                {
                        float look_scale = thickness(dot(n_eye_look_dir, eye_sky_dir), 635.0);
                        float sun_scale = thickness(dot(n_eye_sun_dir, eye_sky_dir), 635.0);