In learning more about linear algebra I've figured out that if we have the model matrix of an object, for the most part the objects position is 0,0,0 multiplied through the model matrix.
26 lines
474 B
GLSL
26 lines
474 B
GLSL
#version 330 core
|
|
layout (location = 0) in vec3 aPos;
|
|
layout (location = 1) in vec3 aNormal;
|
|
layout (location = 2) in vec2 aTexCoord;
|
|
|
|
uniform mat4 MVP;
|
|
uniform mat4 Model;
|
|
|
|
out vec2 ourTexCoord;
|
|
out vec3 ourNormCoord;
|
|
|
|
//Pbr
|
|
out vec3 WorldPos;
|
|
|
|
//Normals
|
|
out mat3 TBN;
|
|
|
|
void main()
|
|
{
|
|
gl_Position = MVP * Model * vec4(aPos, 1.0);
|
|
ourNormCoord = aNormal;
|
|
ourTexCoord = aTexCoord;
|
|
|
|
// Calculate position of fragment
|
|
WorldPos = vec3(Model * vec4(aPos, 1.0));
|
|
};
|