aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources')
-rw-r--r--src/main/resources/shaders/chunk.frag28
-rw-r--r--src/main/resources/shaders/chunk.vert18
2 files changed, 45 insertions, 1 deletions
diff --git a/src/main/resources/shaders/chunk.frag b/src/main/resources/shaders/chunk.frag
index 03ae8e4..aadd55f 100644
--- a/src/main/resources/shaders/chunk.frag
+++ b/src/main/resources/shaders/chunk.frag
@@ -2,7 +2,13 @@
out vec4 FragColor;
in vec2 TexCoord;
+#ifdef RPLE
+in vec2 BTexCoordR;
+in vec2 BTexCoordG;
+in vec2 BTexCoordB;
+#else
in vec2 BTexCoord;
+#endif
in vec4 Color;
in vec4 Viewport;
in mat4 ProjInv;
@@ -11,7 +17,13 @@ in vec2 FogStartEnd;
in float FogFactor;
uniform sampler2D atlas;
+#ifdef RPLE
+uniform sampler2D lightTexR;
+uniform sampler2D lightTexG;
+uniform sampler2D lightTexB;
+#else
uniform sampler2D lightTex;
+#endif
void main()
{
@@ -23,7 +35,21 @@ void main()
vec4 colorMult = Color/256.0;
- vec4 lightyColor = texture(lightTex, (BTexCoord + 8.0) / 256.0);
+ vec4 lightyColor =
+#ifdef RPLE
+ // RPLE assumes that we're using the legacy opengl pipeline, so it creates 3 textures:
+ // color dark bright
+ // RED: Cyan -> White
+ // GREEN: Magenta -> White
+ // BLUE: Yellow -> White
+ // In each texture, only a single channel varies, while the other 2 are set to 1, so the result becomes:
+ // (r, 1, 1) * (1, g, 1) * (1, 1, b) = (r, g, b)
+ texture(lightTexR, (BTexCoordR + 32767) / 65535.0) *
+ texture(lightTexG, (BTexCoordG + 32767) / 65535.0) *
+ texture(lightTexB, (BTexCoordB + 32767) / 65535.0);
+#else
+ texture(lightTex, (BTexCoord + 8.0) / 256.0);
+#endif
vec4 rasterColor =
#ifdef PASS_0
diff --git a/src/main/resources/shaders/chunk.vert b/src/main/resources/shaders/chunk.vert
index 67ce114..9988605 100644
--- a/src/main/resources/shaders/chunk.vert
+++ b/src/main/resources/shaders/chunk.vert
@@ -1,7 +1,13 @@
#version 330 core
layout (location = ATTRIB_POS) in vec3 aPos;
layout (location = ATTRIB_TEXTURE) in vec2 aTexCoord;
+#ifdef RPLE
+layout (location = ATTRIB_BRIGHTNESS_RED) in vec2 aBTexCoordR;
+layout (location = ATTRIB_BRIGHTNESS_GREEN) in vec2 aBTexCoordG;
+layout (location = ATTRIB_BRIGHTNESS_BLUE) in vec2 aBTexCoordB;
+#else
layout (location = ATTRIB_BRIGHTNESS) in vec2 aBTexCoord;
+#endif
layout (location = ATTRIB_COLOR) in vec4 aColor;
uniform mat4 modelView;
@@ -16,7 +22,13 @@ uniform float fogDensity;
uniform vec3 playerPos;
out vec2 TexCoord;
+#ifdef RPLE
+out vec2 BTexCoordR;
+out vec2 BTexCoordG;
+out vec2 BTexCoordB;
+#else
out vec2 BTexCoord;
+#endif
out vec4 Color;
out vec4 Viewport;
out mat4 ProjInv;
@@ -28,7 +40,13 @@ void main()
{
gl_Position = proj * modelView * (vec4(aPos - playerPos, 1.0) + vec4(0, 0.12, 0, 0));
TexCoord = aTexCoord;
+#ifdef RPLE
+ BTexCoordR = aBTexCoordR;
+ BTexCoordG = aBTexCoordG;
+ BTexCoordB = aBTexCoordB;
+#else
BTexCoord = aBTexCoord;
+#endif
Color = aColor;
Viewport = viewport;