Prześlij pliki do 'shaders'

This commit is contained in:
Michał Ciesiółka 2023-01-30 23:53:45 +01:00
parent 5fc6ad7c00
commit c56eab6316
2 changed files with 28 additions and 0 deletions

11
shaders/skybox.frag Normal file
View File

@ -0,0 +1,11 @@
#version 330 core
out vec4 FragColor;
in vec3 texCoords;
uniform samplerCube skybox;
void main()
{
FragColor = texture(skybox, texCoords);
}

17
shaders/skybox.vert Normal file
View File

@ -0,0 +1,17 @@
#version 330 core
layout (location = 0) in vec3 aPos;
out vec3 texCoords;
uniform mat4 projection;
uniform mat4 view;
void main()
{
vec4 pos = projection * view * vec4(aPos, 1.0f);
// Having z equal w will always result in a depth of 1.0f
gl_Position = vec4(pos.x, pos.y, pos.w, pos.w);
// We want to flip the z axis due to the different coordinate systems (left hand vs right hand)
texCoords = vec3(aPos.x, aPos.y, -aPos.z);
}