spooky-game/assets/shaders/sprite-vertex.glsl

34 lines
712 B
GLSL
Executable File

#version 130
in vec3 vPosition;
in vec2 vTexCoords;
in vec3 vNormal;
out vec3 vPosition2;
out vec2 vTexCoords2;
out vec3 vNormal2;
uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
uniform mat3 normalMatrix;
mat4 modelViewMatrix;
mat4 modelViewProjectionMatrix;
void main() {
// Handle texCoords
vTexCoords2 = vTexCoords;
// Handle normal
vNormal2 = normalize(normalMatrix * vNormal);
// Matrices
modelViewMatrix = viewMatrix * modelMatrix;
modelViewProjectionMatrix = projectionMatrix * modelViewMatrix;
// Handle position
vPosition2 = vec3((modelViewMatrix * vec4(vPosition, 1.0)).xyz);
gl_Position = modelViewProjectionMatrix * vec4(vPosition, 1.0);
}