things
This commit is contained in:
@@ -6,6 +6,7 @@ import me.cortex.voxy.client.TimingStatistics;
|
|||||||
import me.cortex.voxy.client.core.gl.GlBuffer;
|
import me.cortex.voxy.client.core.gl.GlBuffer;
|
||||||
import me.cortex.voxy.client.core.gl.shader.Shader;
|
import me.cortex.voxy.client.core.gl.shader.Shader;
|
||||||
import me.cortex.voxy.client.core.gl.shader.ShaderType;
|
import me.cortex.voxy.client.core.gl.shader.ShaderType;
|
||||||
|
import me.cortex.voxy.client.core.rendering.GeometryCache;
|
||||||
import me.cortex.voxy.client.core.rendering.ISectionWatcher;
|
import me.cortex.voxy.client.core.rendering.ISectionWatcher;
|
||||||
import me.cortex.voxy.client.core.rendering.building.BuiltSection;
|
import me.cortex.voxy.client.core.rendering.building.BuiltSection;
|
||||||
import me.cortex.voxy.client.core.rendering.section.geometry.BasicAsyncGeometryManager;
|
import me.cortex.voxy.client.core.rendering.section.geometry.BasicAsyncGeometryManager;
|
||||||
@@ -61,6 +62,8 @@ public class AsyncNodeManager {
|
|||||||
private final BasicAsyncGeometryManager geometryManager;
|
private final BasicAsyncGeometryManager geometryManager;
|
||||||
private final IGeometryData geometryData;
|
private final IGeometryData geometryData;
|
||||||
|
|
||||||
|
private final GeometryCache geometryCache = new GeometryCache(1L<<32);
|
||||||
|
|
||||||
private final AtomicInteger workCounter = new AtomicInteger();
|
private final AtomicInteger workCounter = new AtomicInteger();
|
||||||
|
|
||||||
@SuppressWarnings("FieldMayBeFinal")
|
@SuppressWarnings("FieldMayBeFinal")
|
||||||
@@ -740,6 +743,9 @@ public class AsyncNodeManager {
|
|||||||
private long usedGeometry;
|
private long usedGeometry;
|
||||||
private final ComputeMemoryCopy geometryUpload = new ComputeMemoryCopy();
|
private final ComputeMemoryCopy geometryUpload = new ComputeMemoryCopy();
|
||||||
|
|
||||||
|
//Gpu geometry downloads
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Scatter writes for both geometry and node metadata
|
//Scatter writes for both geometry and node metadata
|
||||||
private MemoryBuffer scatterWriteBuffer = new MemoryBuffer(8192*2);
|
private MemoryBuffer scatterWriteBuffer = new MemoryBuffer(8192*2);
|
||||||
|
|||||||
@@ -132,12 +132,14 @@ public class NodeCleaner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldCleanGeometry() {
|
private boolean shouldCleanGeometry() {
|
||||||
//// if there is less than 200mb of space, clean
|
if (false) {
|
||||||
//return this.nodeManager.getGeometryManager().getRemainingCapacity() < 1_000_000_000L;
|
|
||||||
|
|
||||||
//If used more than 75% of geometry buffer
|
//If used more than 75% of geometry buffer
|
||||||
long used = this.nodeManager.getUsedGeometryCapacity();
|
long used = this.nodeManager.getUsedGeometryCapacity();
|
||||||
return 3<((double)used)/((double)(this.nodeManager.getGeometryCapacity()-used));
|
return 3 < ((double) used) / ((double) (this.nodeManager.getGeometryCapacity() - used));
|
||||||
|
} else {
|
||||||
|
long remaining = this.nodeManager.getGeometryCapacity() - this.nodeManager.getUsedGeometryCapacity();
|
||||||
|
return remaining < 256_000_000;//If less than 256 mb free memory
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateIds(IntOpenHashSet collection) {
|
public void updateIds(IntOpenHashSet collection) {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import me.cortex.voxy.common.world.WorldEngine;
|
|||||||
import org.lwjgl.system.MemoryUtil;
|
import org.lwjgl.system.MemoryUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import static me.cortex.voxy.common.world.WorldEngine.MAX_LOD_LAYER;
|
import static me.cortex.voxy.common.world.WorldEngine.MAX_LOD_LAYER;
|
||||||
import static me.cortex.voxy.common.world.WorldEngine.UPDATE_TYPE_BLOCK_BIT;
|
import static me.cortex.voxy.common.world.WorldEngine.UPDATE_TYPE_BLOCK_BIT;
|
||||||
@@ -255,9 +256,6 @@ public class NodeManager {
|
|||||||
//Removes geometry possible with downloading to cache
|
//Removes geometry possible with downloading to cache
|
||||||
this.geometryManager.removeSection(id);
|
this.geometryManager.removeSection(id);
|
||||||
}
|
}
|
||||||
//TODO: FIXME: add method to clear geometry cache of position, or the geometry is empty etc jkdfgsl
|
|
||||||
// this is for cpu/ram side geometry caching
|
|
||||||
// TODO: IMPLEMENT
|
|
||||||
|
|
||||||
private int uploadReplaceSection(int meshId, BuiltSection section) {
|
private int uploadReplaceSection(int meshId, BuiltSection section) {
|
||||||
if (section.isEmpty()) {
|
if (section.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user