summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'cwd/assets/altcraft/shaders')
-rw-r--r--cwd/assets/altcraft/shaders/entity.json3
-rw-r--r--cwd/assets/altcraft/shaders/frag/entity.fs11
-rw-r--r--cwd/assets/altcraft/shaders/frag/sky.fs23
-rw-r--r--cwd/assets/altcraft/shaders/sky.json3
-rw-r--r--cwd/assets/altcraft/shaders/vert/entity.vs17
-rw-r--r--cwd/assets/altcraft/shaders/vert/sky.vs18
6 files changed, 32 insertions, 43 deletions
diff --git a/cwd/assets/altcraft/shaders/entity.json b/cwd/assets/altcraft/shaders/entity.json
index 0b65c72..33a32e9 100644
--- a/cwd/assets/altcraft/shaders/entity.json
+++ b/cwd/assets/altcraft/shaders/entity.json
@@ -3,8 +3,7 @@
"frag": "/altcraft/shaders/frag/entity",
"uniforms": [
"color",
- "view",
- "projection",
+ "projView",
"model"
]
} \ No newline at end of file
diff --git a/cwd/assets/altcraft/shaders/frag/entity.fs b/cwd/assets/altcraft/shaders/frag/entity.fs
index 6a11c96..06d5759 100644
--- a/cwd/assets/altcraft/shaders/frag/entity.fs
+++ b/cwd/assets/altcraft/shaders/frag/entity.fs
@@ -1,10 +1,9 @@
#version 330 core
-uniform vec3 color;
-in vec2 uvPos;
out vec4 fragColor;
-void main(){
- //if (uvPos.x < 0.9 && uvPos.x > 0.1 && uvPos.y < 0.9 && uvPos.y > 0.1) discard;
- fragColor = vec4(color,1);
-} \ No newline at end of file
+uniform vec3 color;
+
+void main() {
+ fragColor = vec4(color, 1);
+}
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
+}
diff --git a/cwd/assets/altcraft/shaders/sky.json b/cwd/assets/altcraft/shaders/sky.json
index 6e53db6..f4c8813 100644
--- a/cwd/assets/altcraft/shaders/sky.json
+++ b/cwd/assets/altcraft/shaders/sky.json
@@ -2,8 +2,7 @@
"vert": "/altcraft/shaders/vert/sky",
"frag": "/altcraft/shaders/frag/sky",
"uniforms": [
- "view",
- "projection",
+ "projView",
"model",
"textureAtlas",
"DayTime",
diff --git a/cwd/assets/altcraft/shaders/vert/entity.vs b/cwd/assets/altcraft/shaders/vert/entity.vs
index baa25e5..e38c54c 100644
--- a/cwd/assets/altcraft/shaders/vert/entity.vs
+++ b/cwd/assets/altcraft/shaders/vert/entity.vs
@@ -1,13 +1,10 @@
#version 330 core
-uniform mat4 view;
-uniform mat4 projection;
-uniform mat4 model;
-layout (location = 0) in vec3 position;
-layout (location = 1) in vec2 uvPosition;
-out vec2 uvPos;
+in vec3 position;
-void main(){
- uvPos = uvPosition;
- gl_Position = projection*view*model*vec4(position,1);
-} \ No newline at end of file
+uniform mat4 projView;
+uniform mat4 model;
+
+void main() {
+ gl_Position = projView * model * vec4(position, 1);
+}
diff --git a/cwd/assets/altcraft/shaders/vert/sky.vs b/cwd/assets/altcraft/shaders/vert/sky.vs
index 983e1f3..0ab261c 100644
--- a/cwd/assets/altcraft/shaders/vert/sky.vs
+++ b/cwd/assets/altcraft/shaders/vert/sky.vs
@@ -1,17 +1,13 @@
#version 330 core
-uniform mat4 view;
-uniform mat4 projection;
-uniform mat4 model;
+in vec3 position;
-layout (location = 0) in vec3 position;
-layout (location = 1) in vec2 uvPosition;
-
-out vec2 uvPos;
out vec3 pos;
-void main(){
- uvPos = uvPosition;
+uniform mat4 projView;
+uniform mat4 model;
+
+void main() {
pos = position;
- gl_Position = projection*view*model*vec4(position,1);
-} \ No newline at end of file
+ gl_Position = projView * model * vec4(position, 1);
+}