|
|
@ -18,7 +18,15 @@ varying vec2 emissiveMapUV;
|
|
|
|
|
|
|
|
|
|
|
|
varying float depth;
|
|
|
|
varying float depth;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PER_PIXEL_LIGHTING 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !PER_PIXEL_LIGHTING
|
|
|
|
varying vec4 lighting;
|
|
|
|
varying vec4 lighting;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
varying vec3 passViewPos;
|
|
|
|
|
|
|
|
varying vec3 passViewNormal;
|
|
|
|
|
|
|
|
varying vec4 passColour;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "lighting.glsl"
|
|
|
|
#include "lighting.glsl"
|
|
|
|
|
|
|
|
|
|
|
@ -47,9 +55,11 @@ void main(void)
|
|
|
|
emissiveMapUV = (gl_TextureMatrix[@emissiveMapUV] * gl_MultiTexCoord@emissiveMapUV).xy;
|
|
|
|
emissiveMapUV = (gl_TextureMatrix[@emissiveMapUV] * gl_MultiTexCoord@emissiveMapUV).xy;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if !PER_PIXEL_LIGHTING
|
|
|
|
lighting = doLighting(viewPos.xyz, viewNormal, gl_Color);
|
|
|
|
lighting = doLighting(viewPos.xyz, viewNormal, gl_Color);
|
|
|
|
|
|
|
|
#else
|
|
|
|
// TODO: make clamp configurable
|
|
|
|
passViewPos = viewPos.xyz;
|
|
|
|
// the following produces fixed-function compatible lighting, w/o clamp arguably looks better
|
|
|
|
passViewNormal = viewNormal;
|
|
|
|
//lighting = clamp(lighting, vec4(0.0, 0.0, 0.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0));
|
|
|
|
passColour = gl_Color;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|