depth_buf.set_wrap(CLAMP_TO_EDGE);
depth_buf.storage(DEPTH_COMPONENT, size, size);
fbo.attach(DEPTH_ATTACHMENT, depth_buf, 0);
+ fbo.require_complete();
set_darkness(0.7);
set_texture_unit(3);
{
/* XXX Not really proper way to support positional lights, but good
enough when the light source is far away */
- lpos.x -= target.x;
- lpos.y -= target.y;
- lpos.z -= target.z;
+ lpos -= Vector4(target.x, target.y, target.z, 1.0f);
}
- float l = sqrt(lpos.x*lpos.x+lpos.y*lpos.y+lpos.z*lpos.z);
- lpos.x /= l;
- lpos.y /= l;
- lpos.z /= l;
+ lpos.normalize();
float matrix[16];
if(abs(lpos.z)>=abs(lpos.x) && abs(lpos.z)>=abs(lpos.y))