uniform mat4 mat_camera, mat_project, mat_object2world, mat_world2uv;

attribute vec3 va_position, va_normal;

varying vec4 projectorUV;
varying vec3 normalWS, worldPos, viewPos;

void main(void) {

	projectorUV = mat_world2uv * (mat_object2world * vec4(va_position, 1.0));
	normalWS = (mat_object2world * vec4(va_normal, 0.0)).xyz; // TODO: NormalMatrix
	
	vec4 posWS  = mat_object2world * vec4(va_position, 1.0);
	vec4 posVS  = mat_camera       * posWS;
	gl_Position = mat_project      * posVS;

	worldPos = posWS.xyz;
	viewPos  = posVS.xyz;	
	
	gl_FrontColor = gl_Color;
	
}