summaryrefslogtreecommitdiffstats
path: root/cwd/assets
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-11-27 17:08:58 +0100
committerLaG1924 <lag1924@gmail.com>2021-11-27 17:08:58 +0100
commitc905ede556c892d39fd69d3945026ba244567ce9 (patch)
tree86b0d1f5f3ba47358bfb3a89c1dba9ae9a344a39 /cwd/assets
parentAdded ShaderParametersBuffer to GalOgl (diff)
downloadAltCraft-c905ede556c892d39fd69d3945026ba244567ce9.tar
AltCraft-c905ede556c892d39fd69d3945026ba244567ce9.tar.gz
AltCraft-c905ede556c892d39fd69d3945026ba244567ce9.tar.bz2
AltCraft-c905ede556c892d39fd69d3945026ba244567ce9.tar.lz
AltCraft-c905ede556c892d39fd69d3945026ba244567ce9.tar.xz
AltCraft-c905ede556c892d39fd69d3945026ba244567ce9.tar.zst
AltCraft-c905ede556c892d39fd69d3945026ba244567ce9.zip
Diffstat (limited to 'cwd/assets')
-rw-r--r--cwd/assets/altcraft/shaders/frag/entity.fs12
-rw-r--r--cwd/assets/altcraft/shaders/frag/face.fs4
-rw-r--r--cwd/assets/altcraft/shaders/frag/fbo.fs12
-rw-r--r--cwd/assets/altcraft/shaders/frag/light.fs8
-rw-r--r--cwd/assets/altcraft/shaders/frag/rml.fs8
-rw-r--r--cwd/assets/altcraft/shaders/frag/rmltex.fs12
-rw-r--r--cwd/assets/altcraft/shaders/frag/sky.fs10
-rw-r--r--cwd/assets/altcraft/shaders/vert/entity.vs12
-rw-r--r--cwd/assets/altcraft/shaders/vert/face.vs15
-rw-r--r--cwd/assets/altcraft/shaders/vert/fbo.vs23
-rw-r--r--cwd/assets/altcraft/shaders/vert/light.vs7
-rw-r--r--cwd/assets/altcraft/shaders/vert/pp.vs7
-rw-r--r--cwd/assets/altcraft/shaders/vert/rml.vs27
-rw-r--r--cwd/assets/altcraft/shaders/vert/sky.vs16
14 files changed, 112 insertions, 61 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/entity.fs b/cwd/assets/altcraft/shaders/frag/entity.fs
index 06d5759..be4da09 100644
--- a/cwd/assets/altcraft/shaders/frag/entity.fs
+++ b/cwd/assets/altcraft/shaders/frag/entity.fs
@@ -1,9 +1,15 @@
#version 330 core
-out vec4 fragColor;
+layout (location = 0) out vec4 color;
+layout (location = 1) out vec4 normal;
+layout (location = 2) out vec4 addColor;
+layout (location = 3) out vec4 light;
-uniform vec3 color;
+uniform vec3 entityColor;
void main() {
- fragColor = vec4(color, 1);
+ color = vec4(entityColor, 1.0f);
+ normal = vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ addColor = vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ light = vec4(1.0f, 1.0f, 0.0f, 1.0f);
}
diff --git a/cwd/assets/altcraft/shaders/frag/face.fs b/cwd/assets/altcraft/shaders/frag/face.fs
index 57ea0ec..ebda304 100644
--- a/cwd/assets/altcraft/shaders/frag/face.fs
+++ b/cwd/assets/altcraft/shaders/frag/face.fs
@@ -1,6 +1,6 @@
#version 330 core
-in vec3 faceTexture;
+in vec3 faceTextureUv;
in vec3 faceAddColor;
in vec3 faceNormal;
in vec2 faceLight;
@@ -13,7 +13,7 @@ layout (location = 3) out vec4 light;
uniform sampler2DArray textureAtlas;
void main() {
- vec4 col = texture(textureAtlas, faceTexture);
+ vec4 col = texture(textureAtlas, faceTextureUv);
if (col.a < 0.3)
discard;
diff --git a/cwd/assets/altcraft/shaders/frag/fbo.fs b/cwd/assets/altcraft/shaders/frag/fbo.fs
index df624b3..a5a7a2b 100644
--- a/cwd/assets/altcraft/shaders/frag/fbo.fs
+++ b/cwd/assets/altcraft/shaders/frag/fbo.fs
@@ -1,11 +1,11 @@
#version 330 core
-out vec4 FragColor;
-in vec2 TexCoords;
+in vec2 uv;
+
+out vec4 fragColor;
uniform sampler2D inputTexture;
-void main()
-{
- FragColor = texture(inputTexture, TexCoords);
-} \ No newline at end of file
+void main() {
+ fragColor = texture(inputTexture, uv);
+}
diff --git a/cwd/assets/altcraft/shaders/frag/light.fs b/cwd/assets/altcraft/shaders/frag/light.fs
index 6d05884..07eb3ec 100644
--- a/cwd/assets/altcraft/shaders/frag/light.fs
+++ b/cwd/assets/altcraft/shaders/frag/light.fs
@@ -10,9 +10,15 @@ uniform sampler2D addColor;
uniform sampler2D light;
uniform sampler2D depthStencil;
-uniform float dayTime;
uniform int renderBuff;
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
+
void main() {
vec4 c = texture(color, uv);
vec4 n = texture(normal, uv);
diff --git a/cwd/assets/altcraft/shaders/frag/rml.fs b/cwd/assets/altcraft/shaders/frag/rml.fs
index 54c3f36..fa1c596 100644
--- a/cwd/assets/altcraft/shaders/frag/rml.fs
+++ b/cwd/assets/altcraft/shaders/frag/rml.fs
@@ -1,12 +1,10 @@
#version 330 core
-in VS_OUT {
- vec4 color;
- vec2 tex_coord;
-} fs_in;
+in vec4 color;
+in vec2 uv;
out vec4 fragColor;
void main() {
- fragColor = fs_in.color;
+ fragColor = color;
}
diff --git a/cwd/assets/altcraft/shaders/frag/rmltex.fs b/cwd/assets/altcraft/shaders/frag/rmltex.fs
index d885b3b..af86b5b 100644
--- a/cwd/assets/altcraft/shaders/frag/rmltex.fs
+++ b/cwd/assets/altcraft/shaders/frag/rmltex.fs
@@ -1,14 +1,12 @@
#version 330 core
-uniform sampler2D fontTexture;
-
-in VS_OUT {
- vec4 color;
- vec2 tex_coord;
-} fs_in;
+in vec4 color;
+in vec2 uv;
out vec4 fragColor;
+uniform sampler2D fontTexture;
+
void main() {
- fragColor = fs_in.color * texture(fontTexture, fs_in.tex_coord);
+ fragColor = color * texture(fontTexture, uv);
}
diff --git a/cwd/assets/altcraft/shaders/frag/sky.fs b/cwd/assets/altcraft/shaders/frag/sky.fs
index 3763bdb..32b7da0 100644
--- a/cwd/assets/altcraft/shaders/frag/sky.fs
+++ b/cwd/assets/altcraft/shaders/frag/sky.fs
@@ -7,8 +7,14 @@ layout (location = 1) out vec4 normal;
layout (location = 2) out vec4 addColor;
layout (location = 3) out vec4 light;
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
+
uniform sampler2DArray textureAtlas;
-uniform float DayTime;
uniform vec4 sunTexture;
uniform float sunTextureLayer;
uniform vec4 moonTexture;
@@ -49,7 +55,7 @@ vec4 Moon() {
void main() {
vec4 starColor = vec4(0.0f, 0.04f, 0.06f, 1.0f);
- color = vec4(mix(starColor, DaySkyColor, DayTime).rgb, 1.0f);
+ color = vec4(mix(starColor, DaySkyColor, dayTime).rgb, 1.0f);
color += vec4(Sun().rgb, 1.0f);
color += vec4(Moon().rgb, 1.0f);
normal = vec4(0.0f, 0.0f, 0.0f, 1.0f);
diff --git a/cwd/assets/altcraft/shaders/vert/entity.vs b/cwd/assets/altcraft/shaders/vert/entity.vs
index e38c54c..b2f1db6 100644
--- a/cwd/assets/altcraft/shaders/vert/entity.vs
+++ b/cwd/assets/altcraft/shaders/vert/entity.vs
@@ -1,10 +1,16 @@
#version 330 core
-in vec3 position;
+in vec3 pos;
-uniform mat4 projView;
uniform mat4 model;
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
+
void main() {
- gl_Position = projView * model * vec4(position, 1);
+ gl_Position = projView * model * vec4(pos, 1);
}
diff --git a/cwd/assets/altcraft/shaders/vert/face.vs b/cwd/assets/altcraft/shaders/vert/face.vs
index d73e164..5fb9357 100644
--- a/cwd/assets/altcraft/shaders/vert/face.vs
+++ b/cwd/assets/altcraft/shaders/vert/face.vs
@@ -1,6 +1,6 @@
#version 330 core
-in vec3 position[4];
+in vec3 pos[4];
in vec3 normal;
in vec2 uv[4];
in float uvLayer;
@@ -8,22 +8,23 @@ in float animation;
in vec3 color;
in vec2 light;
-out vec3 faceTexture;
+out vec3 faceTextureUv;
out vec3 faceNormal;
out vec3 faceAddColor;
out vec2 faceLight;
-uniform float GlobalTime;
-
layout (std140) uniform Globals {
mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
};
void main() {
- gl_Position = projView * vec4(position[gl_VertexID], 1.0f);
+ gl_Position = projView * vec4(pos[gl_VertexID], 1.0f);
- faceTexture = vec3(uv[gl_VertexID], uvLayer);
- faceTexture.y -= (uv[2].y - uv[0].y) * trunc(mod(GlobalTime * 4.0f, animation));
+ faceTextureUv = vec3(uv[gl_VertexID], uvLayer);
+ faceTextureUv.y -= (uv[2].y - uv[0].y) * trunc(mod(globalTime * 4.0f, animation));
faceNormal = normal;
faceAddColor = color;
diff --git a/cwd/assets/altcraft/shaders/vert/fbo.vs b/cwd/assets/altcraft/shaders/vert/fbo.vs
index e1e8966..e490da5 100644
--- a/cwd/assets/altcraft/shaders/vert/fbo.vs
+++ b/cwd/assets/altcraft/shaders/vert/fbo.vs
@@ -1,11 +1,18 @@
#version 330 core
-layout (location = 0) in vec2 Pos;
-layout (location = 1) in vec2 TextureCoords;
-out vec2 TexCoords;
+in vec2 pos;
+in vec2 uvPos;
-void main()
-{
- gl_Position = vec4(Pos.x, Pos.y, 0.0, 1.0);
- TexCoords = TextureCoords;
-} \ No newline at end of file
+out vec2 uv;
+
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
+
+void main() {
+ gl_Position = vec4(pos.x, pos.y, 0.0, 1.0);
+ uv = uvPos;
+}
diff --git a/cwd/assets/altcraft/shaders/vert/light.vs b/cwd/assets/altcraft/shaders/vert/light.vs
index f837ebe..0033107 100644
--- a/cwd/assets/altcraft/shaders/vert/light.vs
+++ b/cwd/assets/altcraft/shaders/vert/light.vs
@@ -5,6 +5,13 @@ in vec2 uvPos;
out vec2 uv;
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
+
void main() {
gl_Position = vec4(pos.x, pos.y, 0.0, 1.0);
uv = uvPos;
diff --git a/cwd/assets/altcraft/shaders/vert/pp.vs b/cwd/assets/altcraft/shaders/vert/pp.vs
index f837ebe..0033107 100644
--- a/cwd/assets/altcraft/shaders/vert/pp.vs
+++ b/cwd/assets/altcraft/shaders/vert/pp.vs
@@ -5,6 +5,13 @@ in vec2 uvPos;
out vec2 uv;
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
+
void main() {
gl_Position = vec4(pos.x, pos.y, 0.0, 1.0);
uv = uvPos;
diff --git a/cwd/assets/altcraft/shaders/vert/rml.vs b/cwd/assets/altcraft/shaders/vert/rml.vs
index bdd3b71..d82308e 100644
--- a/cwd/assets/altcraft/shaders/vert/rml.vs
+++ b/cwd/assets/altcraft/shaders/vert/rml.vs
@@ -1,22 +1,25 @@
#version 330 core
-uniform uvec2 viewportSize;
-uniform vec2 translation;
-uniform mat4 rotationMat;
+in vec2 pos;
+in uvec4 col;
+in vec2 uvPos;
+
+out vec4 color;
+out vec2 uv;
-layout (location = 0) in vec2 pos;
-layout (location = 1) in uvec4 color;
-layout (location = 2) in vec2 tex_coord;
+uniform vec2 translation;
-out VS_OUT {
- vec4 color;
- vec2 tex_coord;
-} vs_out;
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
void main() {
float x = ((pos.x + translation.x) / viewportSize.x) * 2.0f - 1.0f;
float y = ((pos.y + translation.y) / viewportSize.y) * 2.0f - 1.0f;
gl_Position = vec4(x, -y, -1.0f, 1.0f);
- vs_out.color = vec4(float(color.x) / 255.0f, float(color.y) / 255.0f, float(color.z) / 255.0f, float(color.w) / 255.0f);
- vs_out.tex_coord = tex_coord;
+ color = vec4(float(col.x) / 255.0f, float(col.y) / 255.0f, float(col.z) / 255.0f, float(col.w) / 255.0f);
+ uv = uvPos;
}
diff --git a/cwd/assets/altcraft/shaders/vert/sky.vs b/cwd/assets/altcraft/shaders/vert/sky.vs
index 0ab261c..e580843 100644
--- a/cwd/assets/altcraft/shaders/vert/sky.vs
+++ b/cwd/assets/altcraft/shaders/vert/sky.vs
@@ -1,13 +1,19 @@
#version 330 core
-in vec3 position;
+in vec3 pos;
-out vec3 pos;
+out vec3 facePos;
-uniform mat4 projView;
uniform mat4 model;
+layout (std140) uniform Globals {
+ mat4 projView;
+ uvec2 viewportSize;
+ float globalTime;
+ float dayTime;
+};
+
void main() {
- pos = position;
- gl_Position = projView * model * vec4(position, 1);
+ facePos = pos;
+ gl_Position = projView * model * vec4(pos, 1);
}