Brenta Engine 1.2
Loading...
Searching...
No Matches
phong_vs.c
1static const char* phong_vs = "#version 330 core\n"
2"layout (location = 0) in vec3 aPos;\n"
3"layout (location = 1) in vec3 aNormal;\n"
4"layout (location = 2) in vec2 aTexCoords;\n"
5" \n"
6"uniform mat4 model;\n"
7"uniform mat4 view;\n"
8"uniform mat4 projection;\n"
9"\n"
10"uniform int atlasSize = 4;\n"
11"uniform int atlasIndex = 0;\n"
12"\n"
13"out vec3 Normal;\n"
14"out vec3 FragPos; // position of the fragment in world space\n"
15"out vec2 TexCoords;\n"
16"\n"
17"void main()\n"
18"{\n"
19" gl_Position = projection * view * model * vec4(aPos, 1.0);\n"
20" // Use this the normal matrix (tranpose of the inverse of the model)\n"
21" // when we have non-uniform scaling\n"
22" Normal = mat3(transpose(inverse(model))) * aNormal;\n"
23" FragPos = vec3(model * vec4(aPos, 1.0));\n"
24"\n"
25" // Atlas offset\n"
26" vec2 offset = vec2((1.0 / atlasSize) * (atlasIndex % atlasSize), 0.0);\n"
27" TexCoords = aTexCoords + offset;\n"
28"}\n"
29;