#version 330 core
precision highp float;

// PBR model shader for Verso::Model3d (verso.object3d): world-space position/normal/tangent out.

in vec3 position;
in vec2 uv;
in vec3 normal;
in vec4 tangent; // xyz tangent, w bitangent handedness (+1/-1)

out vec2 ex_Uv;
out vec3 ex_FragPos;
out vec3 ex_Normal;
out vec4 ex_Tangent;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;


void main()
{
	gl_Position = projection * view * model * vec4(position, 1.0);
	ex_FragPos = vec3(model * vec4(position, 1.0));
	ex_Uv = uv;
	ex_Normal = mat3(transpose(inverse(model))) * normal;
	ex_Tangent = vec4(mat3(model) * tangent.xyz, tangent.w);
}
