Adds various rendering related optimizations.

* Deferred lighting now used stencil masking and an additional stencil geometry pass to avoid unnecessary per-pixel calculations
* Packed some properties into vec4s
* Added some checks to avoid unnecessary state changes
* Added caching mechanism for uniform locations to avoid stalling the GPU all the time
* Tweaked point light attenuation function