Prześlij pliki do 'shaders'
This commit is contained in:
parent
5fc6ad7c00
commit
c56eab6316
11
shaders/skybox.frag
Normal file
11
shaders/skybox.frag
Normal 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
17
shaders/skybox.vert
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user