Start prep for temporal

This commit is contained in:
mcrcortex
2025-04-25 16:37:24 +10:00
parent f023f8e8f1
commit 862afc498e
4 changed files with 32 additions and 27 deletions

View File

@@ -27,7 +27,7 @@ public class VoxyConfig implements OptionStorage<VoxyConfig> {
public boolean ingestEnabled = true; public boolean ingestEnabled = true;
public int sectionRenderDistance = 16; public int sectionRenderDistance = 16;
public int serviceThreads = Math.max(Runtime.getRuntime().availableProcessors()/2, 1); public int serviceThreads = Math.max(Runtime.getRuntime().availableProcessors()/2, 1);
public float subDivisionSize = 128; public float subDivisionSize = 64;
public boolean renderVanillaFog = false; public boolean renderVanillaFog = false;
public boolean renderStatistics = false; public boolean renderStatistics = false;

View File

@@ -112,6 +112,10 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
} }
private void renderTemporalTerrain() {
}
private void renderTerrain() { private void renderTerrain() {
//RenderLayer.getCutoutMipped().startDrawing(); //RenderLayer.getCutoutMipped().startDrawing();
@@ -142,6 +146,30 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
this.renderTerrain(); this.renderTerrain();
} }
@Override
public void renderTranslucent(MDICViewport viewport) {
if (this.geometryManager.getSectionCount() == 0) return;
glEnable(GL_BLEND);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
this.terrainShader.bind();
glBindVertexArray(RenderService.STATIC_VAO);//Needs to be before binding
this.bindRenderingBuffers();
glMultiDrawElementsIndirectCountARB(GL_TRIANGLES, GL_UNSIGNED_SHORT, TRANSLUCENT_OFFSET*5*4, 4*4, Math.min(this.geometryManager.getSectionCount(), 100_000), 0);
glEnable(GL_CULL_FACE);
glBindVertexArray(0);
glBindSampler(0, 0);
glBindTextureUnit(0, 0);
glBindSampler(1, 0);
glBindTextureUnit(1, 0);
glDisable(GL_BLEND);
}
@Override @Override
public void buildDrawCallsAndRenderTemporal(MDICViewport viewport, GlBuffer sectionRenderList) { public void buildDrawCallsAndRenderTemporal(MDICViewport viewport, GlBuffer sectionRenderList) {
if (this.geometryManager.getSectionCount() == 0) return; if (this.geometryManager.getSectionCount() == 0) return;
@@ -203,6 +231,7 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, this.drawCountCallBuffer.id); glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, this.drawCountCallBuffer.id);
glDispatchComputeIndirect(0); glDispatchComputeIndirect(0);
glMemoryBarrier(GL_COMMAND_BARRIER_BIT|GL_SHADER_STORAGE_BARRIER_BIT); glMemoryBarrier(GL_COMMAND_BARRIER_BIT|GL_SHADER_STORAGE_BARRIER_BIT);
if (RenderStatistics.enabled) { if (RenderStatistics.enabled) {
DownloadStream.INSTANCE.download(this.statisticsBuffer, down->{ DownloadStream.INSTANCE.download(this.statisticsBuffer, down->{
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
@@ -217,31 +246,6 @@ public class MDICSectionRenderer extends AbstractSectionRenderer<MDICViewport, B
} }
} }
@Override
public void renderTranslucent(MDICViewport viewport) {
if (this.geometryManager.getSectionCount() == 0) return;
glEnable(GL_BLEND);
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
this.terrainShader.bind();
glBindVertexArray(RenderService.STATIC_VAO);//Needs to be before binding
this.bindRenderingBuffers();
glMultiDrawElementsIndirectCountARB(GL_TRIANGLES, GL_UNSIGNED_SHORT, TRANSLUCENT_OFFSET*5*4, 4*4, Math.min(this.geometryManager.getSectionCount(), 100_000), 0);
glEnable(GL_CULL_FACE);
glBindVertexArray(0);
glBindSampler(0, 0);
glBindTextureUnit(0, 0);
glBindSampler(1, 0);
glBindTextureUnit(1, 0);
glDisable(GL_BLEND);
}
@Override @Override
public void addDebug(List<String> lines) { public void addDebug(List<String> lines) {
super.addDebug(lines); super.addDebug(lines);

View File

@@ -63,8 +63,8 @@ layout(binding = DRAW_COUNT_BUFFER_BINDING, std430) restrict buffer DrawCommandC
uint opaqueDrawCount; uint opaqueDrawCount;
uint translucentDrawCount; uint translucentDrawCount;
uint temporalOpaqueDrawCount;
uint pad_A;
DrawCommand cullDrawIndirectCommand; DrawCommand cullDrawIndirectCommand;
}; };
#endif #endif

View File

@@ -14,6 +14,7 @@ void main() {
opaqueDrawCount = 0; opaqueDrawCount = 0;
translucentDrawCount = 0; translucentDrawCount = 0;
temporalOpaqueDrawCount = 0;
cullDrawIndirectCommand.count = 6*2*3; cullDrawIndirectCommand.count = 6*2*3;
cullDrawIndirectCommand.instanceCount = sectionCount; cullDrawIndirectCommand.instanceCount = sectionCount;