Skip to content

Commit 57b8c44

Browse files
authored
Merge pull request #10 from KTStephano/dev
Adding skybox shader
2 parents 5ced026 + 61ae5b0 commit 57b8c44

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

resources/shaders/skybox.fs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
STRATUS_GLSL_VERSION
2+
3+
in vec3 fsTexCoords;
4+
5+
layout (location = 0) out vec4 fsColor;
6+
7+
uniform samplerCube skybox;
8+
9+
void main() {
10+
fsColor = texture(skybox, fsTexCoords);
11+
}

resources/shaders/skybox.vs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
STRATUS_GLSL_VERSION
2+
3+
layout (location = 0) in vec3 position;
4+
5+
out vec3 fsTexCoords;
6+
7+
uniform mat4 projection;
8+
uniform mat4 view;
9+
10+
void main() {
11+
fsTexCoords = position;
12+
vec4 pos = projection * view * vec4(position, 1.0);
13+
// Set the z and w components to w so that w / w = 1.0 which
14+
// is the maximum depth value. This will allow the graphics pipeline
15+
// to know that we always want the skybox to fail the depth test if a valid
16+
// pixel is already in the buffer from a previous stage.
17+
gl_Position = pos.xyww;
18+
}

0 commit comments

Comments
 (0)