added IBR lighting from irradiance maps
[demo] / gl_shaders / default.v.glsl
index 455759d..76aae8a 100644 (file)
@@ -3,11 +3,13 @@
 
 uniform mat4 mview;
 uniform mat4 mmviewproj;
+uniform mat4 mmod;
 
 varying vec3 pos;
-varying vec3 normal;
-varying vec3 ldir;
+// varying vec3 normal;
+// varying vec3 ldir;
 varying vec2 tex_coord;
+varying vec3 world_normal;
 
 const vec3 lpos = vec3(-10.0, 100.0, 10.0);
 
@@ -21,9 +23,11 @@ void main()
        gl_Position = mmviewproj * vec4(attr_pos, 1.0);
 
        pos = (mview * vec4(attr_pos, 1.0)).xyz;
-       ldir = (mview * vec4(lpos, 1.0)).xyz;
+       // ldir = (mview * vec4(lpos, 1.0)).xyz;
 
-       mat3 normal_matrix = mat3(mview);
-       normal = normal_matrix * attr_normal;
+       // mat3 normal_matrix = mat3(mview);
+       // normal = normal_matrix * attr_normal;
        tex_coord = attr_tex;
+
+       world_normal = (mmod * vec4(attr_normal, 1.0)).xyz;
 }
\ No newline at end of file