From: Mikko Rasa Date: Tue, 7 Apr 2015 12:18:17 +0000 (+0300) Subject: Fix some minor shader errors X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=46aa663ef44397ca9e33b8248896d56c58002b35;p=r2c2.git Fix some minor shader errors --- diff --git a/data/r2c2/sky.shader b/data/r2c2/sky.shader index 2c7628a..529050e 100644 --- a/data/r2c2/sky.shader +++ b/data/r2c2/sky.shader @@ -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);