#version 150 //GL 3.2

#include "data/shader/ubo.glsl"

uniform bool transform_with_matr_M = true;



in vec3 attrib_vert;



void main()
{
	vec3 vert_wld;
	if (transform_with_matr_M)
	{
		mat4x3 matr_M = inst_matrs_M[ inst_offset + gl_InstanceID ];
		vert_wld = matr_M * vec4( attrib_vert, 1.0 );
	}
	else
	{
		vec4 translate_scale = inst_vecs[ inst_offset + gl_InstanceID ];
		vert_wld = attrib_vert*translate_scale.w + translate_scale.xyz;
	}
	vec4 vert_clip = matr_PV_light * vec4( vert_wld, 1.0 );
	gl_Position = vert_clip;
}
