summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/shaders/frag/sky.fs
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2021-12-25 07:42:52 +0100
committerGitHub <noreply@github.com>2021-12-25 07:42:52 +0100
commit40421159568518bb7573903d14a2c69c64dead95 (patch)
tree15c830dce151bf0b427123efd214173742887e8e /cwd/assets/altcraft/shaders/frag/sky.fs
parentMerge pull request #70 from LaG1924/ftr/build-3 (diff)
parentFixed missing APIENTRY linux build (diff)
downloadAltCraft-40421159568518bb7573903d14a2c69c64dead95.tar
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.gz
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.bz2
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.lz
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.xz
AltCraft-40421159568518bb7573903d14a2c69c64dead95.tar.zst
AltCraft-40421159568518bb7573903d14a2c69c64dead95.zip
Diffstat (limited to 'cwd/assets/altcraft/shaders/frag/sky.fs')
-rw-r--r--cwd/assets/altcraft/shaders/frag/sky.fs23
1 files changed, 11 insertions, 12 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/sky.fs b/cwd/assets/altcraft/shaders/frag/sky.fs
index 2f51267..53e0cf4 100644
--- a/cwd/assets/altcraft/shaders/frag/sky.fs
+++ b/cwd/assets/altcraft/shaders/frag/sky.fs
@@ -1,6 +1,5 @@
#version 330 core
-in vec2 uvPos;
in vec3 pos;
out vec4 fragColor;
@@ -12,11 +11,11 @@ uniform float sunTextureLayer;
uniform vec4 moonTexture;
uniform float moonTextureLayer;
-const vec4 DaySkyColor = vec4(0.49,0.66,1, 1);
+const vec4 DaySkyColor = vec4(0.49, 0.66, 1, 1);
-const vec3 SunPos = vec3(0,0.1,0.5);
+const vec3 SunPos = vec3(0, 0.1, 0.5);
-const vec3 MoonPos = vec3(0,0.1,-0.5);
+const vec3 MoonPos = vec3(0, 0.1, -0.5);
vec3 TransformTextureCoord(vec4 TextureAtlasCoords, vec2 UvCoords, float Layer) {
float x = TextureAtlasCoords.x;
@@ -25,23 +24,23 @@ vec3 TransformTextureCoord(vec4 TextureAtlasCoords, vec2 UvCoords, float Layer)
float h = TextureAtlasCoords.w;
vec2 A = vec2(x, 1 - y - h);
vec2 B = vec2(x + w, 1 - y);
- vec2 transformed = A + UvCoords * (B - A);
+ vec2 transformed = A + UvCoords * (B - A);
return vec3(transformed.x, transformed.y, Layer);
}
vec4 Sun() {
- vec3 sunDelta = (pos - SunPos)*3.0f;
+ vec3 sunDelta = (pos - SunPos) * 3.0f;
float distanceToSun = length(sunDelta);
- vec4 sunColor = texture(textureAtlas,TransformTextureCoord(sunTexture,(vec2(sunDelta.xy)+0.5f),sunTextureLayer));
- vec4 sun = mix(vec4(0,0,0,1),sunColor,clamp(1-distanceToSun*2.0f,0,1));
+ vec4 sunColor = texture(textureAtlas, TransformTextureCoord(sunTexture, (vec2(sunDelta.xy) + 0.5f), sunTextureLayer));
+ vec4 sun = mix(vec4(0, 0, 0, 1), sunColor, clamp(1 - distanceToSun * 2.0f, 0, 1));
return sun;
}
vec4 Moon() {
- vec3 moonDelta = (pos - MoonPos)*4.5f;
+ vec3 moonDelta = (pos - MoonPos) * 4.5f;
float distanceToMoon = length(moonDelta);
- vec4 moonColor = texture(textureAtlas,TransformTextureCoord(moonTexture,(vec2(moonDelta.xy)+0.5f),moonTextureLayer));
- vec4 moon = mix(vec4(0,0,0,1),moonColor,clamp(1-distanceToMoon*2.0f,0,1));
+ vec4 moonColor = texture(textureAtlas, TransformTextureCoord(moonTexture, (vec2(moonDelta.xy) + 0.5f), moonTextureLayer));
+ vec4 moon = mix(vec4(0, 0, 0, 1),moonColor, clamp(1 - distanceToMoon * 2.0f, 0, 1));
return moon;
}
@@ -50,4 +49,4 @@ void main() {
fragColor = mix(starColor, DaySkyColor, DayTime);
fragColor += Sun();
fragColor += Moon();
-} \ No newline at end of file
+}