This commit is contained in:
mcrcortex
2025-03-30 11:10:27 +10:00
parent 9f604dfc2e
commit 9cf7652ae3
3 changed files with 34 additions and 5 deletions

View File

@@ -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<T extends AbstractSectionRenderer<J, ?>, 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

View File

@@ -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;

View File

@@ -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");
}