2022-12-20 11:44:38 +00:00
|
|
|
#version 420 core
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 pos;
|
|
|
|
layout(location = 1) in vec2 inTexCoord;
|
|
|
|
layout(location = 2) in vec3 normals;
|
|
|
|
|
|
|
|
layout(std140, binding = 0) uniform Camera
|
|
|
|
{
|
|
|
|
mat4 projection;
|
|
|
|
mat4 view;
|
|
|
|
vec3 position;
|
|
|
|
} camera;
|
|
|
|
|
|
|
|
uniform mat4 model;
|
|
|
|
|
2022-12-20 11:49:07 +00:00
|
|
|
out vec3 vertex; // Позиция вершины в пространстве
|
2022-12-20 11:44:38 +00:00
|
|
|
out vec3 N; // Нормаль трансформированноая
|
2022-12-20 11:49:07 +00:00
|
|
|
out vec2 texCoord; // Текстурные координаты
|
2022-12-20 11:44:38 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
vec4 P = model * vec4(pos, 1.0); // трансформация вершины
|
2022-12-20 11:49:07 +00:00
|
|
|
vertex = P.xyz;
|
|
|
|
|
|
|
|
N = normalize(mat3(model) * normals); // трансформация нормали
|
2022-12-20 11:44:38 +00:00
|
|
|
|
2022-12-20 11:49:07 +00:00
|
|
|
texCoord = inTexCoord; // Текстурные координаты
|
2022-12-20 11:44:38 +00:00
|
|
|
|
|
|
|
gl_Position = camera.projection * camera.view * P;
|
|
|
|
}
|