Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/java/me/cortex/voxy/client/config/VoxyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class VoxyConfig {
public int serviceThreads = (int) Math.max(CpuLayout.getCoreCount()/1.5, 1);
public float subDivisionSize = 64;
public boolean useEnvironmentalFog = true;
public boolean renderBeaconBeams = true;
public boolean dontUseSodiumBuilderThreads = false;
public String ssaoMode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ public void registerConfigLate(ConfigBuilder B) {
},"voxy:enabled", RENDER_RELOAD)
.setPostChangeFlags("voxy:iris_reload")
.setEnabler("voxy:enabled")
), new Group(
new BoolOption(
"voxy:render_beacon_beams",
Component.translatable("voxy.config.general.render_beacon_beams"),
()->CFG.renderBeaconBeams, v->CFG.renderBeaconBeams=v)
), new Group(
new IntOption(
"voxy:subdivsize",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.List;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;

import static org.lwjgl.opengl.GL11C.GL_ALWAYS;
import static org.lwjgl.opengl.GL11C.GL_DEPTH_TEST;
Expand Down Expand Up @@ -53,6 +54,7 @@ public abstract class AbstractRenderPipeline extends TrackedObject {
private final HierarchicalOcclusionTraverser traversal;

protected AbstractSectionRenderer<?,?> sectionRenderer;
private Consumer<Viewport<?>> afterTranslucentRenderer;

private final FullscreenBlit depthStencilSetup;

Expand Down Expand Up @@ -85,6 +87,10 @@ public final void setSectionRenderer(AbstractSectionRenderer<?,?> sectionRendere
this.sectionRenderer = sectionRenderer;
}

public final void setAfterTranslucentRenderer(Consumer<Viewport<?>> renderer) {
this.afterTranslucentRenderer = renderer;
}

//Called before the pipeline starts running, used to update uniforms etc
public void preSetup(Viewport<?> viewport) {

Expand Down Expand Up @@ -127,6 +133,9 @@ public void runPipeline(Viewport<?> viewport, int sourceFrameBuffer, int srcWidt
if (!this.deferTranslucency) {
rs.renderTranslucent(viewport);
}
if (this.afterTranslucentRenderer != null) {
this.afterTranslucentRenderer.accept(viewport);
}
GPUTiming.INSTANCE.marker();

this.finish(viewport, sourceFrameBuffer, srcWidth, srcHeight);
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/me/cortex/voxy/client/core/VoxyRenderSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import me.cortex.voxy.client.core.gl.GlTexture;
import me.cortex.voxy.client.core.model.ModelBakerySubsystem;
import me.cortex.voxy.client.core.model.ModelStore;
import me.cortex.voxy.client.core.rendering.BeaconBeamRenderer;
import me.cortex.voxy.client.core.rendering.ChunkBoundRenderer;
import me.cortex.voxy.client.core.rendering.RenderDistanceTracker;
import me.cortex.voxy.client.core.rendering.Viewport;
Expand Down Expand Up @@ -72,6 +73,7 @@ public class VoxyRenderSystem {

private final AbstractRenderPipeline pipeline;
private final RenderProperties properties;
private final BeaconBeamRenderer beaconBeamRenderer;

private static AbstractSectionRenderer.Factory<?,? extends IGeometryData> getRenderBackendFactory() {
//TODO: need todo a thing where selects optimal section render based on if supports the pipeline and geometry data type
Expand Down Expand Up @@ -117,8 +119,6 @@ public VoxyRenderSystem(WorldEngine world, ServiceManager sm) {
this.nodeCleaner = new NodeCleaner(this.nodeManager);
this.traversal = new HierarchicalOcclusionTraverser(this.nodeManager, this.nodeCleaner, this.renderGen);

world.setDirtyCallback(this.nodeManager::worldEvent);

Arrays.stream(world.getMapper().getBiomeEntries()).forEach(this.modelService::addBiome);
world.getMapper().setBiomeCallback(this.modelService::addBiome);

Expand All @@ -135,6 +135,12 @@ public VoxyRenderSystem(WorldEngine world, ServiceManager sm) {
var sectionRenderer = backendFactory.create(this.pipeline, this.modelService.getStore(), this.geometryData);
this.pipeline.setSectionRenderer(sectionRenderer);
this.viewportSelector = new ViewportSelector<>(sectionRenderer::createViewport);
this.beaconBeamRenderer = new BeaconBeamRenderer(world, this.properties);
this.pipeline.setAfterTranslucentRenderer(this.beaconBeamRenderer::render);
world.setDirtyCallback((section, updateFlags, neighborMsk) -> {
this.nodeManager.worldEvent(section, updateFlags, neighborMsk);
this.beaconBeamRenderer.worldEvent(section, updateFlags, neighborMsk);
});

{
int minSec = Minecraft.getInstance().level.getMinSectionY() >> 5;
Expand Down Expand Up @@ -512,6 +518,7 @@ public void shutdown() {
}

this.chunkBoundRenderer.free();
this.beaconBeamRenderer.free();

this.viewportSelector.free();
} catch (Exception e) {Logger.error("Error shutting down renderer components", e);}
Expand Down
Loading