summaryrefslogtreecommitdiff
path: root/engine/src/renderer/opengl/glsl/vertex.glsl
blob: b57caa650fd18d9c5252dd70a365e2395205107e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#version 330 core

#preinclude "vertex_data.glsl"

layout (location = 0) in vec3 pos;
layout (location = 1) in vec2 texture_coords;
layout (location = 2) in vec3 normal;

out VertexData vertex_data;

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

void main()
{
	gl_Position = projection * view * model * vec4(pos, 1.0);

	vertex_data.world_space_pos = vec3(model * vec4(pos, 1.0));
	vertex_data.texture_coords = texture_coords;

	// TODO: Do this using CPU for performance increase
	vertex_data.world_space_normal = mat3(transpose(inverse(model))) * normal;
}