]> git.tdb.fi Git - libs/gl.git/blobdiff - shaderlib/msp_interface.glsl
Move lighting calculations to world space
[libs/gl.git] / shaderlib / msp_interface.glsl
index 2458b97d6b2d08e36de81c6e3f2397b32c930aa8..e35b984845cf318fc0ec70b9b18042719ab6f12e 100644 (file)
@@ -1,8 +1,7 @@
 struct LightSourceParameters
 {
        vec4 position;
-       vec4 diffuse;
-       vec4 specular;
+       vec3 color;
 };
 
 struct ClipPlane
@@ -10,12 +9,12 @@ struct ClipPlane
        vec4 equation;
 };
 
-uniform mat4 eye_obj_matrix;
-uniform mat3 eye_obj_normal_matrix;
+uniform mat4 world_obj_matrix;
+uniform mat3 world_obj_normal_matrix;
 uniform Transform
 {
        mat4 eye_world_matrix;
-       mat4 projection_matrix;
+       mat4 clip_eye_matrix;
 };
 
 uniform Lighting
@@ -24,13 +23,14 @@ uniform Lighting
        LightSourceParameters light_sources[1];
        vec4 ambient_color;
        vec4 sky_color;
-       vec3 eye_zenith_dir;
+       vec3 world_zenith_dir;
        float horizon_limit;
        vec4 fog_color;
        float fog_density;
 };
 
-layout(constant_id=auto) const int max_clip_planes = 0;
+layout(constant_id=auto) const bool use_clipping = false;
+layout(constant_id=auto) const int max_clip_planes = 8;
 uniform Clipping
 {
        ClipPlane clip_planes[max_clip_planes];
@@ -41,11 +41,12 @@ layout(location=0) in vec4 vertex;
 layout(location=1) in vec4 color;
 layout(location=2) in vec3 normal;
 layout(location=3) in vec3 tangent;
-layout(location=4) in vec3 binormal;
-layout(location=7) in vec4 texcoord;
-layout(location=8) in vec4 texcoord1;
-layout(location=9) in vec4 texcoord2;
-layout(location=10) in vec4 texcoord3;
+layout(location=4) in vec4 group;
+layout(location=5) in vec4 weight;
+layout(location=6) in vec4 texcoord;
+layout(location=7) in vec4 texcoord1;
+layout(location=8) in vec4 texcoord2;
+layout(location=9) in vec4 texcoord3;
 layout(location=13) in vec4 instance_transform[3];
 
 #pragma MSP stage(fragment)