]> git.tdb.fi Git - libs/gl.git/blobdiff - shaderlib/common.glsl
Rearrange some things in the shader library
[libs/gl.git] / shaderlib / common.glsl
index 695bce3b5da4ca0d8b06c5785a8bcea6f2c1da3a..249cae7c67e9c65c64d6dd4ab8a9829dd0ed8ef8 100644 (file)
@@ -75,12 +75,6 @@ void main()
 }
 
 #pragma MSP stage(fragment)
-struct IncomingLight
-{
-       vec3 direction;
-       vec3 color;
-};
-
 layout(location=0) out vec4 frag_color;
 
 virtual vec3 get_fragment_normal()
@@ -93,15 +87,6 @@ virtual vec3 get_fragment_normal()
                return sgn*normalize(world_normal);
 }
 
-virtual IncomingLight get_incoming_light(int index, vec3 world_pos)
-{
-       vec4 light_pos = light_sources[index].position;
-       vec3 rel_pos = light_pos.xyz-world_pos*light_pos.w;
-       float d = length(rel_pos);
-       float attenuation = 1.0/dot(vec3(1.0, d, d*d), light_sources[index].attenuation);
-       return IncomingLight(rel_pos/d, light_sources[index].color*attenuation);
-}
-
 float apply_alpha_cutoff(float alpha, AlphaCutoffParams params)
 {
        if(use_alpha_cutoff)