This commit is contained in:
mcrcortex
2024-02-09 11:08:38 +10:00
parent 69b200f894
commit a20a1ce7fc
5 changed files with 21 additions and 14 deletions

View File

@@ -105,6 +105,8 @@ dependencies {
include(runtimeOnly "org.lwjgl:lwjgl-lmdb:$lwjglVersion:natives-linux") include(runtimeOnly "org.lwjgl:lwjgl-lmdb:$lwjglVersion:natives-linux")
include(runtimeOnly "org.lwjgl:lwjgl-zstd:$lwjglVersion:natives-linux") include(runtimeOnly "org.lwjgl:lwjgl-zstd:$lwjglVersion:natives-linux")
include(implementation 'org.rocksdb:rocksdbjni:8.10.0') //include(implementation 'org.rocksdb:rocksdbjni:8.10.0')
include(implementation 'redis.clients:jedis:5.1.0') //include(implementation 'redis.clients:jedis:5.1.0')
implementation 'org.rocksdb:rocksdbjni:8.10.0'
implementation 'redis.clients:jedis:5.1.0'
} }

View File

@@ -57,7 +57,7 @@ public class VoxelCore {
SharedIndexBuffer.INSTANCE.id(); SharedIndexBuffer.INSTANCE.id();
this.renderer = new Gl46FarWorldRenderer(VoxyConfig.CONFIG.geometryBufferSize, VoxyConfig.CONFIG.maxSections); this.renderer = new Gl46FarWorldRenderer(VoxyConfig.CONFIG.geometryBufferSize, VoxyConfig.CONFIG.maxSections);
System.out.println("Renderer initialized"); System.out.println("Renderer initialized");
this.world = new WorldEngine(new CompressionStorageAdaptor(new ZSTDCompressor(VoxyConfig.CONFIG.savingCompressionLevel), new RocksDBStorageBackend(new File(VoxyConfig.CONFIG.storagePath))), VoxyConfig.CONFIG.ingestThreads, VoxyConfig.CONFIG.savingThreads, 5); this.world = new WorldEngine(new CompressionStorageAdaptor(new ZSTDCompressor(VoxyConfig.CONFIG.savingCompressionLevel), new FragmentedStorageBackendAdaptor(new File(VoxyConfig.CONFIG.storagePath))), VoxyConfig.CONFIG.ingestThreads, VoxyConfig.CONFIG.savingThreads, 5);
System.out.println("World engine"); System.out.println("World engine");
this.renderTracker = new RenderTracker(this.world, this.renderer); this.renderTracker = new RenderTracker(this.world, this.renderer);

View File

@@ -142,6 +142,8 @@ public class RenderDataFactory {
int selfBlockId = Mapper.getBlockId(self); int selfBlockId = Mapper.getBlockId(self);
long selfMetadata = this.modelMan.getModelMetadata(selfBlockId); long selfMetadata = this.modelMan.getModelMetadata(selfBlockId);
boolean putFace = false; boolean putFace = false;
//Branch into 2 paths, the + direction and -direction, doing it at once makes it much faster as it halves the number of loops //Branch into 2 paths, the + direction and -direction, doing it at once makes it much faster as it halves the number of loops
@@ -249,6 +251,7 @@ public class RenderDataFactory {
} }
int clientModelId = this.modelMan.getModelId(selfBlockId); int clientModelId = this.modelMan.getModelId(selfBlockId);
long otherFlags = 0; long otherFlags = 0;
otherFlags |= ModelManager.isTranslucent(metadata)?1L<<33:0; otherFlags |= ModelManager.isTranslucent(metadata)?1L<<33:0;

View File

@@ -48,7 +48,9 @@ public class WorldEngine {
this.storage.deleteSectionData(into.key); this.storage.deleteSectionData(into.key);
//TODO: regenerate the section from children //TODO: regenerate the section from children
Arrays.fill(into.data, Mapper.AIR); Arrays.fill(into.data, Mapper.AIR);
System.err.println("Section " + into.lvl + ", " + into.x + ", " + into.y + ", " + into.z + " was unable to load, setting to air"); System.err.println("Section " + into.lvl + ", " + into.x + ", " + into.y + ", " + into.z + " was unable to load, removing");
this.storage.deleteSectionData(into.key);
return -1; return -1;
} else { } else {
return 0; return 0;

View File

@@ -8,18 +8,18 @@ layout(location = 2) uniform mat4 MVP;
layout(location = 3) uniform mat4 invMVP; layout(location = 3) uniform mat4 invMVP;
vec3 rev3d(vec3 clip) { vec3 rev3d(vec3 clip) {
vec4 view = invMVP * vec4(clip*2-1,1); vec4 view = invMVP * vec4(clip*2.0-1.0,1.0);
return view.xyz/view.w; return view.xyz/view.w;
} }
vec3 reDeProject(vec3 pos) { vec3 reDeProject(vec3 pos) {
vec4 view = MVP * vec4(pos, 1); vec4 view = MVP * vec4(pos, 1.0);
view.xy /= view.w; view.xy /= view.w;
vec2 UV = clamp(view.xy*0.5+0.5, 0, 1); vec2 UV = clamp(view.xy*0.5+0.5, 0.0, 1.0);
//TODO: sample the colour texture and check if the alpha has the hasAO flag //TODO: sample the colour texture and check if the alpha has the hasAO flag
view.z = texture(depthTex, UV).x*2-1; view.z = texture(depthTex, UV).x*2.0-1.0;
view.w = 1; view.w = 1.0;
view = invMVP * view; view = invMVP * view;
return view.xyz/view.w; return view.xyz/view.w;
} }
@@ -38,7 +38,7 @@ void main() {
return; return;
} }
vec4 colour = imageLoad(colourTex, ivec2(gl_GlobalInvocationID.xy)); vec4 colour = imageLoad(colourTex, ivec2(gl_GlobalInvocationID.xy));
uint metadata = uint(colour.w*255f); uint metadata = uint(colour.w*255.0f);
uint face = metadata&7; uint face = metadata&7;
uint lod = (metadata>>3)&7; uint lod = (metadata>>3)&7;
bool hasAO = (metadata>>6)!=0; bool hasAO = (metadata>>6)!=0;
@@ -50,15 +50,15 @@ void main() {
float d = 0.0; float d = 0.0;
if (hasAO) { if (hasAO) {
d = computeAOAngle(pos, 1*(1<<lod), viewNormal);//1 d = computeAOAngle(pos, 1.0*(1<<lod), viewNormal);//1
if (d<0.1) { if (d<0.1) {
d = 0f; d = 0.0f;
} }
} }
vec4 ocolour = colour; vec4 ocolour = colour;
ocolour.xyz *= ((1f-d)/3f+0.666666f); ocolour.xyz *= ((1.0f-d)/3.0f+0.666666f);
ocolour.w = 1f; ocolour.w = 1.0f;
imageStore(colourTex, ivec2(gl_GlobalInvocationID.xy), ocolour); imageStore(colourTex, ivec2(gl_GlobalInvocationID.xy), ocolour);
} }
//vec4 ocolour = vec4(max(0, d), abs(min(0,d)), 0, 1); //vec4 ocolour = vec4(max(0, d), abs(min(0,d)), 0, 1);