Tweeks
This commit is contained in:
@@ -121,7 +121,7 @@ public class VoxelCore {
|
||||
}
|
||||
|
||||
private AbstractFarWorldRenderer<?,?> createRenderBackend() {
|
||||
if (true) {
|
||||
if (false) {
|
||||
System.out.println("Using Gl46MeshletFarWorldRendering");
|
||||
return new Gl46MeshletsFarWorldRenderer(VoxyConfig.CONFIG.geometryBufferSize, VoxyConfig.CONFIG.maxSections);
|
||||
} else {
|
||||
|
||||
@@ -63,6 +63,8 @@ public class RenderTracker {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: replace this:: with a class cached lambda ref (cause doing this:: still does a lambda allocation)
|
||||
|
||||
//Adds a lvl 0 section into the world renderer
|
||||
public void addLvl0(int x, int y, int z) {
|
||||
this.put(WorldEngine.getWorldSectionId(0, x, y, z));
|
||||
@@ -92,6 +94,7 @@ public class RenderTracker {
|
||||
// concurrent hashmap or something, this is so that e.g. the build data position
|
||||
// can be updated
|
||||
|
||||
//TODO: replace this:: with a class cached lambda ref (cause doing this:: still does a lambda allocation)
|
||||
this.renderGen.enqueueTask(lvl, x, y, z, this::shouldStillBuild);
|
||||
|
||||
this.renderer.enqueueResult(new BuiltSection(WorldEngine.getWorldSectionId(lvl-1, (x<<1), (y<<1), (z<<1))));
|
||||
@@ -129,6 +132,7 @@ public class RenderTracker {
|
||||
this.renderer.enqueueResult(new BuiltSection(WorldEngine.getWorldSectionId(lvl, x, y, z)));
|
||||
this.renderGen.removeTask(lvl, x, y, z);
|
||||
|
||||
//TODO: replace this:: with a class cached lambda ref (cause doing this:: still does a lambda allocation)
|
||||
this.renderGen.enqueueTask(lvl - 1, (x<<1), (y<<1), (z<<1), this::shouldStillBuild);
|
||||
this.renderGen.enqueueTask(lvl - 1, (x<<1), (y<<1), (z<<1)+1, this::shouldStillBuild);
|
||||
this.renderGen.enqueueTask(lvl - 1, (x<<1), (y<<1)+1, (z<<1), this::shouldStillBuild);
|
||||
@@ -157,6 +161,7 @@ public class RenderTracker {
|
||||
|
||||
public void add(int lvl, int x, int y, int z) {
|
||||
this.put(WorldEngine.getWorldSectionId(lvl, x, y, z));
|
||||
//TODO: replace this:: with a class cached lambda ref (cause doing this:: still does a lambda allocation)
|
||||
this.renderGen.enqueueTask(lvl, x, y, z, this::shouldStillBuild);
|
||||
}
|
||||
|
||||
@@ -173,6 +178,7 @@ public class RenderTracker {
|
||||
this.renderGen.clearCache(section.lvl, section.x+1, section.y, section.z);
|
||||
this.renderGen.clearCache(section.lvl, section.x, section.y, section.z-1);
|
||||
this.renderGen.clearCache(section.lvl, section.x, section.y, section.z+1);
|
||||
//TODO: replace this:: with a class cached lambda ref (cause doing this:: still does a lambda allocation)
|
||||
this.renderGen.enqueueTask(section.lvl, section.x, section.y, section.z, this::shouldStillBuild);
|
||||
this.renderGen.enqueueTask(section.lvl, section.x-1, section.y, section.z, this::shouldStillBuild);
|
||||
this.renderGen.enqueueTask(section.lvl, section.x+1, section.y, section.z, this::shouldStillBuild);
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ContextSelectionSystem {
|
||||
throw new RuntimeException("Failed to deserialize the default config, aborting!", e);
|
||||
}
|
||||
if (this.config == null) {
|
||||
throw new IllegalStateException("Config is still null");
|
||||
throw new IllegalStateException("Config is still null: \n"+VoxyConfig.CONFIG.defaultSaveConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ public class WorldConversionFactory {
|
||||
}
|
||||
}
|
||||
data[G(x, y, z)] = Mapper.composeMappingId(light, blockId, biomeId);
|
||||
} else {
|
||||
data[G(x, y, z)] = Mapper.AIR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,11 @@ import static org.lwjgl.util.zstd.Zstd.*;
|
||||
|
||||
public class SaveLoadSystem {
|
||||
|
||||
//TODO: Cache like long2short and the short and other data to stop allocs
|
||||
public static ByteBuffer serialize(WorldSection section) {
|
||||
var data = section.copyData();
|
||||
var compressed = new short[data.length];
|
||||
Long2ShortOpenHashMap LUT = new Long2ShortOpenHashMap();
|
||||
Long2ShortOpenHashMap LUT = new Long2ShortOpenHashMap(data.length);
|
||||
LongArrayList LUTVAL = new LongArrayList();
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
long block = data[i];
|
||||
|
||||
@@ -183,10 +183,13 @@ public class Mapper {
|
||||
return this.blockId2stateEntry.get(blockId).state;
|
||||
}
|
||||
|
||||
//TODO: replace lambda with a class cached lambda ref (cause doing this:: still does a lambda allocation)
|
||||
public int getIdForBlockState(BlockState state) {
|
||||
return this.block2stateEntry.computeIfAbsent(state, this::registerNewBlockState).id;
|
||||
}
|
||||
|
||||
|
||||
//TODO: replace lambda with a class cached lambda ref (cause doing this:: still does a lambda allocation)
|
||||
public int getIdForBiome(RegistryEntry<Biome> biome) {
|
||||
String biomeId = biome.getKey().get().getValue().toString();
|
||||
return this.biome2biomeEntry.computeIfAbsent(biomeId, this::registerNewBiome).id;
|
||||
|
||||
Reference in New Issue
Block a user