Added extra state checking and fixed empty geometry not returning child existence bits, added lighting back

This commit is contained in:
mcrcortex
2024-12-05 19:38:45 +10:00
parent 8c36021746
commit d9fc4b3c05
3 changed files with 14 additions and 7 deletions

View File

@@ -14,12 +14,15 @@ public final class BuiltSection {
public final MemoryBuffer geometryBuffer;
public final int[] offsets;
private BuiltSection(long position) {
this(position, (byte) 0, -1, null, null);
private BuiltSection(long position, byte children) {
this(position, children, -1, null, null);
}
public static BuiltSection empty(long position) {
return new BuiltSection(position);
return new BuiltSection(position, (byte) 0);
}
public static BuiltSection emptyWithChildren(long position, byte children) {
return new BuiltSection(position, children);
}
public BuiltSection(long position, byte childExistence, int aabb, MemoryBuffer geometryBuffer, int[] offsets) {

View File

@@ -210,7 +210,7 @@ public class RenderDataFactory4 {
long nextModel = facingForward == 1 ? B : A;
//Example thing thats just wrong but as example
this.blockMesher.putNext((long) facingForward | ((selfModel & 0xFFFF) << 26) | (0xFFL << 55));
this.blockMesher.putNext((long) facingForward | ((selfModel & 0xFFFF) << 26) | (((nextModel>>16)&0xFF) << 55));
}
}
this.blockMesher.endRow();
@@ -319,7 +319,7 @@ public class RenderDataFactory4 {
long nextModel = facingForward==1?B:A;
//Example thing thats just wrong but as example
mesher.putNext((long) facingForward | ((selfModel&0xFFFF)<<26) | (0xFFL<<55));
mesher.putNext((long) facingForward | ((selfModel&0xFFFF)<<26) | (((nextModel>>16)&0xFF)<<55));
//mesher.emitQuad(y, z, 1, 1,(long) facingForward | ((selfModel&0xFFFF)<<26) | (0xFFL<<55));
}
}
@@ -399,7 +399,7 @@ public class RenderDataFactory4 {
// this stops e.g. multiple layers of glass (and ocean) from having 3000 layers of quads etc
if (this.quadCount == 0) {
return BuiltSection.empty(section.key);
return BuiltSection.emptyWithChildren(section.key, section.getNonEmptyChildren());
}
//TODO: FIXME AND OPTIMIZE, get rid of the stupid quad collector bullshit

View File

@@ -280,7 +280,11 @@ public class NodeManager2 {
int childNodeId = base+offset;
//Fill in node
this.nodeData.setNodePosition(childNodeId, childPos);
this.nodeData.setNodeChildExistence(childNodeId, request.getChildChildExistence(childIdx));
byte childExistence = request.getChildChildExistence(childIdx);
if (childExistence == 0) {
throw new IllegalStateException("Request result with child existence of 0");
}
this.nodeData.setNodeChildExistence(childNodeId, childExistence);
this.nodeData.setNodeGeometry(childNodeId, request.getChildMesh(childIdx));
//Mark for update
this.invalidateNode(childNodeId);