aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
diff options
context:
space:
mode:
authorFalsePattern <me@falsepattern.com>2023-12-01 23:34:25 +0100
committermakamys <makamys@outlook.com>2023-12-02 14:51:33 +0100
commitdd40c5c4b5ad6e4ff03d60892c2498dff708e003 (patch)
tree8d7e358f21cd239d68b53e062aff807ddf846dc4 /src/main/java/makamys/neodymium/renderer/NeoRenderer.java
parent7534096b6f027fd51016618f8862f8dc8b673b5c (diff)
downloadNeodymium-dd40c5c4b5ad6e4ff03d60892c2498dff708e003.tar.gz
Neodymium-dd40c5c4b5ad6e4ff03d60892c2498dff708e003.tar.bz2
Neodymium-dd40c5c4b5ad6e4ff03d60892c2498dff708e003.zip
RPLE compat
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/NeoRenderer.java')
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 048fc7a..613871a 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -21,6 +21,7 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import makamys.neodymium.Compat;
import makamys.neodymium.renderer.attribs.AttributeSet;
import makamys.neodymium.util.BufferWriter;
import org.lwjgl.BufferUtils;
@@ -349,7 +350,14 @@ public class NeoRenderer {
int u_modelView = glGetUniformLocation(shaderProgram, "modelView");
int u_proj = glGetUniformLocation(shaderProgram, "proj");
int u_playerPos = glGetUniformLocation(shaderProgram, "playerPos");
- int u_light = glGetUniformLocation(shaderProgram, "lightTex");
+ int u_light = 0, u_light_r = 0, u_light_g = 0, u_light_b = 0;
+ if (Compat.RPLE()) {
+ u_light_r = glGetUniformLocation(shaderProgram, "lightTexR");
+ u_light_g = glGetUniformLocation(shaderProgram, "lightTexG");
+ u_light_b = glGetUniformLocation(shaderProgram, "lightTexB");
+ } else {
+ u_light = glGetUniformLocation(shaderProgram, "lightTex");
+ }
int u_viewport = glGetUniformLocation(shaderProgram, "viewport");
int u_projInv = glGetUniformLocation(shaderProgram, "projInv");
int u_fogColor = glGetUniformLocation(shaderProgram, "fogColor");
@@ -367,8 +375,16 @@ public class NeoRenderer {
glUniform1f(u_fogDensity, glGetFloat(GL_FOG_DENSITY));
glUniform3f(u_playerPos, (float)eyePosX, (float)eyePosY, (float)eyePosZ);
-
- glUniform1i(u_light, 1);
+
+ if (Compat.RPLE()) {
+ //TODO connect to RPLE gl api (once that exists)
+ // For now we just use the RPLE default texture indices
+ glUniform1i(u_light_r, 1);
+ glUniform1i(u_light_g, 2);
+ glUniform1i(u_light_b, 3);
+ } else {
+ glUniform1i(u_light, 1);
+ }
modelView.position(0);
projBuf.position(0);
@@ -395,7 +411,13 @@ public class NeoRenderer {
} else {
attributes.addAttribute("TEXTURE", 2, 4, GL_FLOAT);
}
- attributes.addAttribute("BRIGHTNESS", 2, 2, GL_SHORT);
+ if (Compat.RPLE()) {
+ attributes.addAttribute("BRIGHTNESS_RED", 2, 2, GL_SHORT);
+ attributes.addAttribute("BRIGHTNESS_GREEN", 2, 2, GL_SHORT);
+ attributes.addAttribute("BRIGHTNESS_BLUE", 2, 2, GL_SHORT);
+ } else {
+ attributes.addAttribute("BRIGHTNESS", 2, 2, GL_SHORT);
+ }
attributes.addAttribute("COLOR", 4, 1, GL_UNSIGNED_BYTE);
reloadShader();
@@ -435,6 +457,9 @@ public class NeoRenderer {
if(Config.shortUV) {
defines.put("SHORT_UV", "");
}
+ if (Compat.RPLE()) {
+ defines.put("RPLE", "");
+ }
if(pass == 0) {
defines.put("PASS_0", "");
}