[Vertex shader]

uniform vec3 scale;

varying vec2 texCoord;
varying vec3 lightCoord;
varying vec4 color;

void main(){
	gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

	texCoord = gl_MultiTexCoord0.xy;
	lightCoord = gl_Vertex.xyz * scale + 0.5;
	color = gl_Color;
}


[Fragment shader]

uniform sampler2D Base;
uniform sampler3D LightVolume;

varying vec2 texCoord;
varying vec3 lightCoord;
varying vec4 color;

void main(){
	vec4 base = texture2D(Base, texCoord);
	float shadow = texture3D(LightVolume, lightCoord).x;

	base.a = base.r * color.a;
	base.rgb *= color.rgb * shadow;

	gl_FragColor = base;
}
