diff options
author | jjesswan <jessica_wan@brown.edu> | 2024-05-07 06:02:29 -0400 |
---|---|---|
committer | jjesswan <jessica_wan@brown.edu> | 2024-05-07 06:02:29 -0400 |
commit | 6a45579dbbf991c0e12ce59958e3b533d19fc9d4 (patch) | |
tree | 83ad11d63c0a1d1c89b9469455ecbda4531fe6ac /resources | |
parent | cb868acadcae4e3f497ecdabeca507f3e73e01c7 (diff) |
rotating skyboxgit add -A
Diffstat (limited to 'resources')
-rw-r--r-- | resources/images/cupertin-lake_bk.png | bin | 0 -> 333350 bytes | |||
-rw-r--r-- | resources/images/cupertin-lake_dn.png | bin | 0 -> 296096 bytes | |||
-rw-r--r-- | resources/images/cupertin-lake_ft.png | bin | 0 -> 340432 bytes | |||
-rw-r--r-- | resources/images/cupertin-lake_lf.png | bin | 0 -> 330551 bytes | |||
-rw-r--r-- | resources/images/cupertin-lake_rt.png | bin | 0 -> 309096 bytes | |||
-rw-r--r-- | resources/images/cupertin-lake_up.png | bin | 0 -> 280744 bytes | |||
-rw-r--r-- | resources/shaders/skybox.frag | 24 | ||||
-rw-r--r-- | resources/shaders/skybox.vert | 21 |
8 files changed, 45 insertions, 0 deletions
diff --git a/resources/images/cupertin-lake_bk.png b/resources/images/cupertin-lake_bk.png Binary files differnew file mode 100644 index 0000000..32ab079 --- /dev/null +++ b/resources/images/cupertin-lake_bk.png diff --git a/resources/images/cupertin-lake_dn.png b/resources/images/cupertin-lake_dn.png Binary files differnew file mode 100644 index 0000000..d742ac6 --- /dev/null +++ b/resources/images/cupertin-lake_dn.png diff --git a/resources/images/cupertin-lake_ft.png b/resources/images/cupertin-lake_ft.png Binary files differnew file mode 100644 index 0000000..2710ff0 --- /dev/null +++ b/resources/images/cupertin-lake_ft.png diff --git a/resources/images/cupertin-lake_lf.png b/resources/images/cupertin-lake_lf.png Binary files differnew file mode 100644 index 0000000..96a55e8 --- /dev/null +++ b/resources/images/cupertin-lake_lf.png diff --git a/resources/images/cupertin-lake_rt.png b/resources/images/cupertin-lake_rt.png Binary files differnew file mode 100644 index 0000000..f383c09 --- /dev/null +++ b/resources/images/cupertin-lake_rt.png diff --git a/resources/images/cupertin-lake_up.png b/resources/images/cupertin-lake_up.png Binary files differnew file mode 100644 index 0000000..1e05235 --- /dev/null +++ b/resources/images/cupertin-lake_up.png diff --git a/resources/shaders/skybox.frag b/resources/shaders/skybox.frag new file mode 100644 index 0000000..926807e --- /dev/null +++ b/resources/shaders/skybox.frag @@ -0,0 +1,24 @@ + +#version 330 core + +in vec3 tex_coord; + +uniform samplerCube cubeMap; +uniform vec3 skyColor; + +out vec4 fragColor; + +const float lowerLimit = -50000.f; +const float upperLimit = 50000.f; + + +void main() { + + //fragColor = vec4(1.f); + vec4 finalColor = texture(cubeMap, tex_coord); + + // blending bottom of skybox to skyColor + float factor = (tex_coord.y - lowerLimit) / (upperLimit - lowerLimit); + factor = clamp(factor, 0.f, 1.f); + fragColor = finalColor; // mix(vec4(skyColor, 1.f), finalColor, factor); +} diff --git a/resources/shaders/skybox.vert b/resources/shaders/skybox.vert new file mode 100644 index 0000000..edf50e4 --- /dev/null +++ b/resources/shaders/skybox.vert @@ -0,0 +1,21 @@ +#version 330 core + +layout(location = 0) in vec3 pos; // Position of the vertex +//layout(location = 1) in vec3 normal; // Normal of the vertex +//layout(location = 3) in vec3 texCoords; + +uniform mat4 view, projection, rotation; + +out vec3 tex_coord; + + + +void main() { + + tex_coord = vec3(pos.x, pos.y, -pos.z); + vec4 world_pos = projection*view*rotation*vec4(pos, 1.0); + gl_Position = vec4(world_pos.x, world_pos.y, world_pos.w, world_pos.w); + +// tex_coord = pos; + // gl_Position = projection*view*vec4(pos, 1.0); +} |