This commit is contained in:
Dane Johnson
2021-01-23 11:54:34 -06:00
parent 14ddf47d0d
commit 776b297150
16 changed files with 199 additions and 3 deletions

View File

@@ -12,7 +12,9 @@ add_shader(flat.vert)
add_shader(flat.frag)
add_shader(screen.vert)
add_shader(screen.frag)
add_shader(skybox.vert)
add_shader(skybox.frag)
add_custom_target(shader_headers
DEPENDS flat.vert.h flat.frag.h screen.vert.h screen.frag.h
DEPENDS flat.vert.h flat.frag.h screen.vert.h screen.frag.h skybox.vert.h skybox.frag.h
COMMENT "Generated shaders headers.")

11
shaders/skybox.frag Normal file
View File

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

14
shaders/skybox.vert Normal file
View File

@@ -0,0 +1,14 @@
#version 330 core
layout (location = 0) in vec3 pos;
out vec3 UV;
uniform mat4 VIEW; // Assuming this is free of translation
uniform mat4 PROJECTION;
void main() {
UV = pos;
vec4 projectedPos = PROJECTION * VIEW * vec4(pos, 1.0);
gl_Position = projectedPos.xyww;
}