From 9cf7652ae3315fd471410007ed3f14df388cda76 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Sun, 30 Mar 2025 11:10:27 +1000 Subject: [PATCH] Aaa --- .../client/core/rendering/RenderService.java | 4 ++- .../building/RenderDataFactory45.java | 33 +++++++++++++++++-- .../me/cortex/voxy/commonImpl/VoxyCommon.java | 2 +- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/RenderService.java b/src/main/java/me/cortex/voxy/client/core/rendering/RenderService.java index ce46342b..36bace49 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/RenderService.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/RenderService.java @@ -1,5 +1,7 @@ package me.cortex.voxy.client.core.rendering; +import io.netty.util.internal.MathUtil; +import me.cortex.voxy.client.core.gl.Capabilities; import me.cortex.voxy.client.core.model.ModelBakerySubsystem; import me.cortex.voxy.client.core.model.ModelStore; import me.cortex.voxy.client.core.rendering.building.BuiltSection; @@ -52,7 +54,7 @@ public class RenderService, J extends Vi //Max sections: ~500k //Max geometry: 1 gb - this.sectionRenderer = (T) createSectionRenderer(this.modelService.getStore(),1<<20, (1L<<31)-1024); + this.sectionRenderer = (T) createSectionRenderer(this.modelService.getStore(),1<<20, Math.min((1L<<(64-Long.numberOfLeadingZeros(Capabilities.INSTANCE.ssboMaxSize-1)))<<1, 1L<<32)-1024/*(1L<<32)-1024*/); Logger.info("Using renderer: " + this.sectionRenderer.getClass().getSimpleName()); //Do something incredibly hacky, we dont need to keep the reference to this around, so just connect and discard diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory45.java b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory45.java index 97af88bc..e7618c73 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory45.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/building/RenderDataFactory45.java @@ -168,6 +168,7 @@ public class RenderDataFactory45 { private final Mesher blockMesher = new Mesher(); + private final Mesher seondaryblockMesher = new Mesher();//Used for dual non-opaque geometry public RenderDataFactory45(WorldEngine world, ModelFactory modelManager, boolean emitMeshlets) { this.world = world; @@ -406,26 +407,36 @@ public class RenderDataFactory45 { private void generateYZNonOpaqueInnerGeometry(int axis) { //Note: think is ok to just reuse.. blockMesher + this.seondaryblockMesher.doAuxiliaryFaceOffset = false; this.blockMesher.axis = axis; - for (int layer = 0; layer < 32; layer++) { + this.seondaryblockMesher.axis = axis; + for (int layer = 0; layer < 32; layer++) {//(should be 1->31, then have outer face mesher) this.blockMesher.auxiliaryPosition = layer; + this.seondaryblockMesher.auxiliaryPosition = layer; + int cSkip = 0; for (int other = 0; other < 32; other++) {//TODO: need to do the faces that border sections int pidx = axis == 0 ? (layer * 32 + other) : (other * 32 + layer); int msk = this.nonOpaqueMasks[pidx]; if (msk == 0) { - this.blockMesher.skip(32); + cSkip += 32; continue; } + this.blockMesher.skip(cSkip); + this.seondaryblockMesher.skip(cSkip); + cSkip = 0; int cIdx = -1; while (msk != 0) { int index = Integer.numberOfTrailingZeros(msk);//Is also the x-axis index int delta = index - cIdx - 1; cIdx = index; //index--; - if (delta != 0) this.blockMesher.skip(delta); + if (delta != 0) { + this.blockMesher.skip(delta); + this.seondaryblockMesher.skip(delta); + } msk &= ~Integer.lowestOneBit(msk); { @@ -436,19 +447,28 @@ public class RenderDataFactory45 { long B = this.sectionData[idx * 2+1]; if (ModelQueries.isTranslucent(B)) { this.blockMesher.putNext(0); + this.seondaryblockMesher.putNext(0); continue; } + //Example thing thats just wrong but as example this.blockMesher.putNext((long) (false ? 0L : 1L) | ((A & 0xFFFFL) << 26) | (((0xFFL) & 0xFF) << 55) | ((A&(0x1FFL<<24))<<(46-24)) ); + this.seondaryblockMesher.putNext((long) (true ? 0L : 1L) | + ((A & 0xFFFFL) << 26) | + (((0xFFL) & 0xFF) << 55) | + ((A&(0x1FFL<<24))<<(46-24)) + ); } } this.blockMesher.endRow(); + this.seondaryblockMesher.endRow(); } this.blockMesher.finish(); + this.seondaryblockMesher.finish(); } } @@ -654,6 +674,11 @@ public class RenderDataFactory45 { mb.doAuxiliaryFaceOffset = true; } + + private void generateXNonOpaqueInnerGeometry() { + + } + private void generateXFaces() { this.generateXOpaqueInnerGeometry(); this.generateXOuterOpaqueGeometry(); @@ -689,6 +714,8 @@ public class RenderDataFactory45 { {//Reset all the block meshes this.blockMesher.reset(); this.blockMesher.doAuxiliaryFaceOffset = true; + this.seondaryblockMesher.reset(); + this.seondaryblockMesher.doAuxiliaryFaceOffset = true; for (var mesher : this.xAxisMeshers) { mesher.reset(); mesher.doAuxiliaryFaceOffset = true; diff --git a/src/main/java/me/cortex/voxy/commonImpl/VoxyCommon.java b/src/main/java/me/cortex/voxy/commonImpl/VoxyCommon.java index 4579b209..be65a65d 100644 --- a/src/main/java/me/cortex/voxy/commonImpl/VoxyCommon.java +++ b/src/main/java/me/cortex/voxy/commonImpl/VoxyCommon.java @@ -30,7 +30,7 @@ public class VoxyCommon implements ModInitializer { } //This is hardcoded like this because people do not understand what they are doing - private static final boolean GlobalVerificationDisableOverride = false;//System.getProperty("voxy.verificationDisableOverride", "false").equals("true"); + private static final boolean GlobalVerificationDisableOverride = true;//System.getProperty("voxy.verificationDisableOverride", "false").equals("true"); public static boolean isVerificationFlagOn(String name) { return (!GlobalVerificationDisableOverride) && System.getProperty("voxy."+name, "true").equals("true"); }