Tinkering
This commit is contained in:
@@ -73,7 +73,7 @@ public class VoxelCore {
|
||||
//Trigger the shared index buffer loading
|
||||
SharedIndexBuffer.INSTANCE.id();
|
||||
this.renderer = new Gl46FarWorldRenderer();
|
||||
this.world = new WorldEngine(new File("storagefile2.db"), 5, 20, 5);//"storagefile.db"//"ethoslab.db"
|
||||
this.world = new WorldEngine(new File("storagefile2.db"), 2, 5, 5);//"storagefile.db"//"ethoslab.db"
|
||||
|
||||
this.renderTracker = new RenderTracker(this.world, this.renderer);
|
||||
this.renderGen = new RenderGenerationService(this.world,5, this.renderTracker::processBuildResult);
|
||||
@@ -83,7 +83,7 @@ public class VoxelCore {
|
||||
//To get to chunk scale multiply the scale by 2, the scale is after how many chunks does the lods halve
|
||||
this.distanceTracker = new DistanceTracker(this.renderTracker, 5, 16);
|
||||
|
||||
this.postProcessing = null;// = new PostProcessing();
|
||||
this.postProcessing = new PostProcessing();
|
||||
|
||||
this.world.getMapper().setCallbacks(this::stateUpdate, this::biomeUpdate);
|
||||
|
||||
@@ -178,8 +178,10 @@ public class VoxelCore {
|
||||
// this is cause the terrain might not exist and so all the caves are visible causing hell for the
|
||||
// occlusion culler
|
||||
this.renderer.renderFarAwayOpaque(matrices, cameraX, cameraY, cameraZ);
|
||||
|
||||
|
||||
//glBindFramebuffer(GL_FRAMEBUFFER, boundFB);
|
||||
// this.postProcessing.renderPost(boundFB);
|
||||
//this.postProcessing.renderPost(boundFB);
|
||||
}
|
||||
|
||||
public void addDebugInfo(List<String> debug) {
|
||||
@@ -198,8 +200,8 @@ public class VoxelCore {
|
||||
// since they are AABBS crossing the normal is impossible without one of the axis being equal
|
||||
|
||||
public void shutdown() {
|
||||
try {this.renderGen.shutdown();} catch (Exception e) {System.err.println(e);}
|
||||
try {this.world.shutdown();} catch (Exception e) {System.err.println(e);}
|
||||
try {this.renderGen.shutdown();} catch (Exception e) {System.err.println(e);}
|
||||
try {this.renderer.shutdown();} catch (Exception e) {System.err.println(e);}
|
||||
try {this.postProcessing.shutdown();} catch (Exception e) {System.err.println(e);}
|
||||
}
|
||||
|
||||
@@ -160,6 +160,17 @@ public class RenderTracker {
|
||||
|
||||
//Called by the world engine when a section gets dirtied
|
||||
public void sectionUpdated(WorldSection section) {
|
||||
if (this.activeSections.containsKey(section.getKey())) {
|
||||
//TODO:FIXME: if the section gets updated, that means that its neighbors might need to be updated aswell
|
||||
// (due to block occlusion)
|
||||
|
||||
//TODO: FIXME: REBUILDING THE ENTIRE NEIGHBORS when probably only the internal layout changed is NOT SMART
|
||||
this.renderGen.enqueueTask(section.lvl, section.x, section.y, section.z, this::shouldStillBuild, this::getBuildFlagsOrAbort);
|
||||
this.renderGen.enqueueTask(section.lvl, section.x-1, section.y, section.z, this::shouldStillBuild, this::getBuildFlagsOrAbort);
|
||||
this.renderGen.enqueueTask(section.lvl, section.x+1, section.y, section.z, this::shouldStillBuild, this::getBuildFlagsOrAbort);
|
||||
this.renderGen.enqueueTask(section.lvl, section.x, section.y, section.z-1, this::shouldStillBuild, this::getBuildFlagsOrAbort);
|
||||
this.renderGen.enqueueTask(section.lvl, section.x, section.y, section.z+1, this::shouldStillBuild, this::getBuildFlagsOrAbort);
|
||||
}
|
||||
//this.renderGen.enqueueTask(section);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,9 @@ public class WorldEngine {
|
||||
MemoryUtil.memFree(data);
|
||||
}
|
||||
} else {
|
||||
//TODO: if we need to fetch an lod from a server, send the request here and block until the request is finished
|
||||
// the response should be put into the local db so that future data can just use that
|
||||
// the server can also send arbitrary updates to the client for arbitrary lods
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,9 @@ import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(WorldRenderer.class)
|
||||
public abstract class MixinWorldRenderer {
|
||||
@@ -16,19 +18,19 @@ public abstract class MixinWorldRenderer {
|
||||
|
||||
@Shadow protected abstract void setupTerrain(Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator);
|
||||
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V"))
|
||||
private void injectSetup(WorldRenderer instance, Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator) {
|
||||
//Call the actual terrain setup method
|
||||
this.setupTerrain(camera, frustum, hasForcedFrustum, spectator);
|
||||
@Shadow private Frustum frustum;
|
||||
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;setupTerrain(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/Frustum;ZZ)V", shift = At.Shift.AFTER))
|
||||
private void injectSetup(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f projectionMatrix, CallbackInfo ci) {
|
||||
//Call our setup method
|
||||
VoxelCore.INSTANCE.renderSetup(frustum, camera);
|
||||
VoxelCore.INSTANCE.renderSetup(this.frustum, camera);
|
||||
}
|
||||
|
||||
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderLayer(Lnet/minecraft/client/render/RenderLayer;Lnet/minecraft/client/util/math/MatrixStack;DDDLorg/joml/Matrix4f;)V", ordinal = 2))
|
||||
private void injectOpaqueRender(WorldRenderer instance, RenderLayer renderLayer, MatrixStack matrices, double cameraX, double cameraY, double cameraZ, Matrix4f positionMatrix) {
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderLayer(Lnet/minecraft/client/render/RenderLayer;Lnet/minecraft/client/util/math/MatrixStack;DDDLorg/joml/Matrix4f;)V", ordinal = 2, shift = At.Shift.AFTER))
|
||||
private void injectOpaqueRender(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f projectionMatrix, CallbackInfo ci) {
|
||||
var cam = camera.getPos();
|
||||
//Call the actual render method
|
||||
this.renderLayer(renderLayer, matrices, cameraX, cameraY, cameraZ, positionMatrix);
|
||||
VoxelCore.INSTANCE.renderOpaque(matrices, cameraX, cameraY, cameraZ);
|
||||
VoxelCore.INSTANCE.renderOpaque(matrices, cam.x, cam.y, cam.z);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "voxelmon",
|
||||
"id": "zenith",
|
||||
"version": "${version}",
|
||||
"name": "voxelmon",
|
||||
"name": "zenith",
|
||||
"description": "",
|
||||
"authors": [],
|
||||
"authors": [
|
||||
"Cortex"
|
||||
],
|
||||
"contact": {
|
||||
},
|
||||
"license": "All-Rights-Reserved",
|
||||
|
||||
Reference in New Issue
Block a user