This commit is contained in:
mcrcortex
2025-03-28 09:49:12 +10:00
parent e812b13ef7
commit 8b3f8812de
5 changed files with 71 additions and 55 deletions

View File

@@ -52,7 +52,7 @@ public class RenderService<T extends AbstractSectionRenderer<J, ?>, J extends Vi
//Max sections: ~500k //Max sections: ~500k
//Max geometry: 1 gb //Max geometry: 1 gb
this.sectionRenderer = (T) createSectionRenderer(this.modelService.getStore(),1<<20, (1L<<32)-1024); this.sectionRenderer = (T) createSectionRenderer(this.modelService.getStore(),1<<20, (1L<<31)-1024);
Logger.info("Using renderer: " + this.sectionRenderer.getClass().getSimpleName()); 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 //Do something incredibly hacky, we dont need to keep the reference to this around, so just connect and discard

View File

@@ -277,7 +277,8 @@ public class RenderDataFactory45 {
private void generateYZOpaqueInnerGeometry(int axis) { private void generateYZOpaqueInnerGeometry(int axis) {
for (int layer = 0; layer < 31; layer++) { for (int layer = 0; layer < 31; layer++) {
this.blockMesher.auxiliaryPosition = layer; this.blockMesher.auxiliaryPosition = layer;
for (int other = 0; other < 32; other++) {//TODO: need to do the faces that border sections int cSkip = 0;
for (int other = 0; other < 32; other++) {
int pidx = axis==0 ?(layer*32+other):(other*32+layer); int pidx = axis==0 ?(layer*32+other):(other*32+layer);
int skipAmount = axis==0?32:1; int skipAmount = axis==0?32:1;
@@ -286,10 +287,13 @@ public class RenderDataFactory45 {
int msk = current ^ next; int msk = current ^ next;
if (msk == 0) { if (msk == 0) {
this.blockMesher.skip(32); cSkip += 32;
continue; continue;
} }
this.blockMesher.skip(cSkip);
cSkip = 0;
//TODO: For boarder sections, should NOT EMIT neighbors faces //TODO: For boarder sections, should NOT EMIT neighbors faces
int faceForwardMsk = msk & current; int faceForwardMsk = msk & current;
int cIdx = -1; int cIdx = -1;
@@ -321,6 +325,7 @@ public class RenderDataFactory45 {
); );
} }
} }
this.blockMesher.endRow(); this.blockMesher.endRow();
} }
this.blockMesher.finish(); this.blockMesher.finish();
@@ -333,14 +338,18 @@ public class RenderDataFactory45 {
for (int side = 0; side < 2; side++) {//-, + for (int side = 0; side < 2; side++) {//-, +
int layer = side == 0 ? 0 : 31; int layer = side == 0 ? 0 : 31;
this.blockMesher.auxiliaryPosition = layer; this.blockMesher.auxiliaryPosition = layer;
int cSkips = 0;
for (int other = 0; other < 32; other++) { for (int other = 0; other < 32; other++) {
int pidx = axis == 0 ? (layer * 32 + other) : (other * 32 + layer); int pidx = axis == 0 ? (layer * 32 + other) : (other * 32 + layer);
int msk = this.opaqueMasks[pidx]; int msk = this.opaqueMasks[pidx];
if (msk == 0) { if (msk == 0) {
this.blockMesher.skip(32); cSkips += 32;
continue; continue;
} }
this.blockMesher.skip(cSkips);
cSkips = 0;
int cIdx = -1; int cIdx = -1;
while (msk != 0) { while (msk != 0) {
int index = Integer.numberOfTrailingZeros(msk);//Is also the x-axis index int index = Integer.numberOfTrailingZeros(msk);//Is also the x-axis index
@@ -384,15 +393,7 @@ public class RenderDataFactory45 {
this.blockMesher.doAuxiliaryFaceOffset = true; this.blockMesher.doAuxiliaryFaceOffset = true;
} }
private void generateYZFaces() { private void generateYZNonOpaqueInnerGeometry(int axis) {
for (int axis = 0; axis < 2; axis++) {//Y then Z
this.blockMesher.axis = axis;
this.generateYZOpaqueInnerGeometry(axis);
this.generateYZOpaqueOuterGeometry(axis);
if (false) {//Non fully opaque geometry
//Note: think is ok to just reuse.. blockMesher //Note: think is ok to just reuse.. blockMesher
this.blockMesher.axis = axis; this.blockMesher.axis = axis;
for (int layer = 0; layer < 32; layer++) { for (int layer = 0; layer < 32; layer++) {
@@ -422,7 +423,7 @@ public class RenderDataFactory45 {
//TODO: swap this out for something not getting the next entry //TODO: swap this out for something not getting the next entry
long A = this.sectionData[idx * 2]; long A = this.sectionData[idx * 2];
long B = this.sectionData[idx * 2+1]; long B = this.sectionData[idx * 2+1];
if (ModelQueries.isFluid(B)) { if (ModelQueries.isTranslucent(B)) {
this.blockMesher.putNext(0); this.blockMesher.putNext(0);
continue; continue;
} }
@@ -439,6 +440,15 @@ public class RenderDataFactory45 {
this.blockMesher.finish(); this.blockMesher.finish();
} }
} }
private void generateYZFaces() {
for (int axis = 0; axis < 2; axis++) {//Y then Z
this.blockMesher.axis = axis;
this.generateYZOpaqueInnerGeometry(axis);
this.generateYZOpaqueOuterGeometry(axis);
//this.generateYZNonOpaqueInnerGeometry(axis);
} }
} }

View File

@@ -101,7 +101,7 @@ public abstract class ScanMesher2D {
//TODO: replace with much better method, TODO: check this is right!! //TODO: replace with much better method, TODO: check this is right!!
this.putNext(0); this.putNext(0);
if (1<count) { if (1<count) {
this.emitRanged(((1 << (count - 1)) - 1) << (this.currentIndex & 31)); this.emitRanged(((1 << (Math.min(count, 32) - 1)) - 1) << (this.currentIndex & 31));
this.currentIndex += count - 1; this.currentIndex += count - 1;
} }
/* /*

View File

@@ -28,7 +28,13 @@ public class Logger {
String error = (INSERT_CLASS?("["+stackEntry.getClassName()+"]: "):"") + Stream.of(args).map(Logger::objToString).collect(Collectors.joining(" ")); String error = (INSERT_CLASS?("["+stackEntry.getClassName()+"]: "):"") + Stream.of(args).map(Logger::objToString).collect(Collectors.joining(" "));
LOGGER.error(error, throwable); LOGGER.error(error, throwable);
if (VoxyCommon.IS_IN_MINECRAFT && !VoxyCommon.IS_DEDICATED_SERVER) { if (VoxyCommon.IS_IN_MINECRAFT && !VoxyCommon.IS_DEDICATED_SERVER) {
MinecraftClient.getInstance().executeSync(()->{var player = MinecraftClient.getInstance().player; if (player != null) player.sendMessage(Text.literal(error), true);}); var instance = MinecraftClient.getInstance();
if (instance != null) {
instance.executeSync(() -> {
var player = MinecraftClient.getInstance().player;
if (player != null) player.sendMessage(Text.literal(error), 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 //This is hardcoded like this because people do not understand what they are doing
private static final boolean GlobalVerificationDisableOverride = true;//System.getProperty("voxy.verificationDisableOverride", "false").equals("true"); private static final boolean GlobalVerificationDisableOverride = false;//System.getProperty("voxy.verificationDisableOverride", "false").equals("true");
public static boolean isVerificationFlagOn(String name) { public static boolean isVerificationFlagOn(String name) {
return (!GlobalVerificationDisableOverride) && System.getProperty("voxy."+name, "true").equals("true"); return (!GlobalVerificationDisableOverride) && System.getProperty("voxy."+name, "true").equals("true");
} }