diff options
author | FalsePattern <me@falsepattern.com> | 2024-01-08 17:02:43 +0100 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2024-01-08 22:49:40 +0100 |
commit | 091d817604149d958dcd3b2ea5c0846e95196024 (patch) | |
tree | c7c0a15006d1f885456fc1ea9b0bbf1589bcb4d4 /src/main/java/makamys/neodymium/renderer/NeoRenderer.java | |
parent | f763808849a028ff5115d1b3a3b2471ee2913bd9 (diff) | |
download | Neodymium-091d817604149d958dcd3b2ea5c0846e95196024.tar.gz Neodymium-091d817604149d958dcd3b2ea5c0846e95196024.tar.bz2 Neodymium-091d817604149d958dcd3b2ea5c0846e95196024.zip |
Make the multi-implementation methods a bit nicer to work with
Diffstat (limited to 'src/main/java/makamys/neodymium/renderer/NeoRenderer.java')
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/NeoRenderer.java | 64 |
1 files changed, 2 insertions, 62 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index 79b6117..d6becc8 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -432,56 +432,6 @@ public class NeoRenderer { fogStartEnd.position(0); } - private void initAttributesRPLEAndShaders() { - attributes.addAttribute("POS", 3, 4, GL_FLOAT); - attributes.addAttribute("TEXTURE", 2, 4, GL_FLOAT); - attributes.addAttribute("COLOR", 4, 1, GL_UNSIGNED_BYTE); - attributes.addAttribute("BRIGHTNESS_RED", 2, 2, GL_SHORT); - attributes.addAttribute("ENTITY_DATA_1", 1, 4, GL_UNSIGNED_INT); - attributes.addAttribute("ENTITY_DATA_2", 1, 4, GL_UNSIGNED_INT); - attributes.addAttribute("NORMAL", 3, 4, GL_FLOAT); - attributes.addAttribute("TANGENT", 4, 4, GL_FLOAT); - attributes.addAttribute("MIDTEXTURE", 2, 4, GL_FLOAT); - attributes.addAttribute("BRIGHTNESS_GREEN", 2, 2, GL_SHORT); - attributes.addAttribute("BRIGHTNESS_BLUE", 2, 2, GL_SHORT); - attributes.addAttribute("EDGE_TEX", 2, 4, GL_FLOAT); - } - - private void initAttributesShaders() { - attributes.addAttribute("POS", 3, 4, GL_FLOAT); - attributes.addAttribute("TEXTURE", 2, 4, GL_FLOAT); - attributes.addAttribute("COLOR", 4, 1, GL_UNSIGNED_BYTE); - attributes.addAttribute("BRIGHTNESS", 2, 2, GL_SHORT); - attributes.addAttribute("ENTITY_DATA_1", 1, 4, GL_UNSIGNED_INT); - attributes.addAttribute("ENTITY_DATA_2", 1, 4, GL_UNSIGNED_INT); - attributes.addAttribute("NORMAL", 3, 4, GL_FLOAT); - attributes.addAttribute("TANGENT", 4, 4, GL_FLOAT); - attributes.addAttribute("MIDTEXTURE", 2, 4, GL_FLOAT); - } - - private void initAttributesRPLE() { - attributes.addAttribute("POS", 3, 4, GL_FLOAT); - if (Config.shortUV) { - attributes.addAttribute("TEXTURE", 2, 2, GL_UNSIGNED_SHORT); - } else { - attributes.addAttribute("TEXTURE", 2, 4, GL_FLOAT); - } - attributes.addAttribute("COLOR", 4, 1, GL_UNSIGNED_BYTE); - attributes.addAttribute("BRIGHTNESS_RED", 2, 2, GL_SHORT); - attributes.addAttribute("BRIGHTNESS_GREEN", 2, 2, GL_SHORT); - attributes.addAttribute("BRIGHTNESS_BLUE", 2, 2, GL_SHORT); - } - - private void initAttributesVanilla() { - attributes.addAttribute("POS", 3, 4, GL_FLOAT); - if (Config.shortUV) { - attributes.addAttribute("TEXTURE", 2, 2, GL_UNSIGNED_SHORT); - } else { - attributes.addAttribute("TEXTURE", 2, 4, GL_FLOAT); - } - attributes.addAttribute("COLOR", 4, 1, GL_UNSIGNED_BYTE); - attributes.addAttribute("BRIGHTNESS", 2, 2, GL_SHORT); - } /** * @implSpec The attributes here need to be kept in sync with {@link MeshQuad#writeToBuffer(BufferWriter, int)} */ @@ -494,17 +444,7 @@ public class NeoRenderer { attributes = new AttributeSet(); - boolean rple = Compat.isRPLEModPresent(); - boolean optiFineShaders = Compat.isOptiFineShadersEnabled(); - if (rple && optiFineShaders) { - initAttributesRPLEAndShaders(); - } else if (optiFineShaders) { - initAttributesShaders(); - } else if (rple) { - initAttributesRPLE(); - } else { - initAttributesVanilla(); - } + Neodymium.util.initVertexAttributes(attributes); reloadShader(); @@ -515,7 +455,7 @@ public class NeoRenderer { glBindBuffer(GL_ARRAY_BUFFER, mem.VBO); - + boolean optiFineShaders = Compat.isOptiFineShadersEnabled(); if (optiFineShaders) { initOptiFineShadersVertexPointers(); } else { |