This commit is contained in:
mcrcortex
2024-02-22 09:59:01 +10:00
parent 7f21ef1d66
commit da7b632240
3 changed files with 99 additions and 5 deletions

View File

@@ -91,11 +91,11 @@ public class VoxyConfigScreenFactory implements ModMenuApi {
.setDefaultValue(DEFAULT.maxSections)
.build());
category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.renderDistance"), config.maxSections, 16, 2048)
.setTooltip(Text.translatable("voxy.config.general.renderDistance.tooltip"))
.setSaveConsumer(val -> config.renderDistance = val)
.setDefaultValue(DEFAULT.renderDistance)
.build());
//category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.renderDistance"), config.maxSections, 16, 2048)
// .setTooltip(Text.translatable("voxy.config.general.renderDistance.tooltip"))
// .setSaveConsumer(val -> config.renderDistance = val)
// .setDefaultValue(DEFAULT.renderDistance)
// .build());
//category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.compression"), config.savingCompressionLevel, 1, 21)
// .setTooltip(Text.translatable("voxy.config.general.compression.tooltip"))

View File

@@ -14,6 +14,7 @@ import static org.lwjgl.opengl.ARBDirectStateAccess.glCopyNamedBufferSubData;
import static org.lwjgl.opengl.ARBDirectStateAccess.glFlushMappedNamedBufferRange;
import static org.lwjgl.opengl.ARBMapBufferRange.*;
import static org.lwjgl.opengl.GL11.glFinish;
import static org.lwjgl.opengl.GL42.GL_ALL_BARRIER_BITS;
import static org.lwjgl.opengl.GL42.glMemoryBarrier;
import static org.lwjgl.opengl.GL42C.GL_BUFFER_UPDATE_BARRIER_BIT;
import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_BARRIER_BIT;
@@ -86,6 +87,7 @@ public class UploadStream {
this.flushList.clear();
}
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT);
glMemoryBarrier(GL_ALL_BARRIER_BITS);
//Execute all the copies
for (var entry : this.uploadList) {

View File

@@ -0,0 +1,92 @@
package me.cortex.voxy.client.terrain.util;
public class QuadTreeClosestPositionFinder {
public QuadTreeClosestPositionFinder() {
}
private static abstract class Node {
}
/*
private static class InnerNode extends Node {
private final long[] nodes = new long[1+8*8+8*8*8*8];
private final Node[] children = new Node[8*8*8*8*8*8];
private long getClosestPoint(long nodePos, int cx, int cz) {
long node = -1;//this.nodes[];
if (node == -1) {
return -1;
}
float metric = Float.MAX_VALUE;
int pos = 0;
while (node != -1) {
int id = Long.numberOfTrailingZeros(node);
node &= ~(1L << id);
int x = id & 7;
int y = (id >> 3) & 7;
}
return -1;
}
}*/
/*
private static class PartialNode extends Node {
private long fullMSK;
private final Node[] children = new Node[8*8];
private final int lvl;
private PartialNode(int lvl) {
this.lvl = lvl;
}
private long getClosestPoint(int[] cacheArray, int cx, int cz) {
long node = this.fullMSK;
int minDist = Integer.MAX_VALUE;
int pointCounter = 0;
while (node != -1) {
int id = Long.numberOfTrailingZeros(node);
node &= ~(1L << id);
int x = id & 7;
int z = (id >> 3) & 7;
int dx = Math.abs(x - (cx >> this.lvl));
int dz = Math.abs(z - (cz >> this.lvl));
int dist = Math.max(dx, dz);
if (dist < minDist) {
pointCounter = 0;
minDist = dist;
}
if (dist == minDist) {
cacheArray[pointCounter++] = id;
}
}
return -1;
}
}*/
/*
private static class InnerNode extends Node {
private final Node[] nodes = new Node[4];
private final int lvl;
private static final int[] ORDERING = new int[]{
0b00_01_10_11,
0b01_00_11_10,
0b10_00_11_01,
0b11_01_10_00,
};
private InnerNode(int lvl) {
this.lvl = lvl;
}
public long getClosestEmpty(long cMin, int cx, int cz) {
int id = (((cz>>this.lvl)&1)<<1) | ((cx>>this.lvl)&1);
int ordering = ORDERING[id];
}
}*/
}