-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.vert
More file actions
48 lines (41 loc) · 1.04 KB
/
default.vert
File metadata and controls
48 lines (41 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#version 330 core
// Positions/Coordinates
layout (location = 0) in vec3 aPos;
// Normals (not necessarily normalized)
layout (location = 1) in vec3 aNormal;
// Colors
layout (location = 2) in vec3 aColor;
// Texture Coordinates
layout (location = 3) in vec2 aTex;
out DATA
{
vec3 Normal;
vec3 color;
vec2 texCoord;
mat4 projection;
mat4 model;
vec3 lightPos;
vec3 camPos;
} data_out;
// Imports the camera matrix
uniform mat4 camMatrix;
// Imports the transformation matrices
uniform mat4 model;
uniform mat4 translation;
uniform mat4 rotation;
uniform mat4 scale;
// Gets the position of the light from the main function
uniform vec3 lightPos;
// Gets the position of the camera from the main function
uniform vec3 camPos;
void main()
{
gl_Position = model * translation * rotation * scale * vec4(aPos, 1.0f);
data_out.Normal = aNormal;
data_out.color = aColor;
data_out.texCoord = aTex;
data_out.projection = camMatrix;
data_out.model = model * translation * rotation * scale;
data_out.lightPos = lightPos;
data_out.camPos = camPos;
}