Fixed flicker
This commit is contained in:
@@ -59,6 +59,8 @@ public abstract class AbstractFarWorldRenderer <T extends Viewport> {
|
||||
|
||||
private final List<T> viewports = new ArrayList<>();
|
||||
|
||||
protected IntArrayList updatedSectionIds;
|
||||
|
||||
private final ConcurrentLinkedDeque<Mapper.StateEntry> blockStateUpdates = new ConcurrentLinkedDeque<>();
|
||||
private final ConcurrentLinkedDeque<Mapper.BiomeEntry> biomeUpdates = new ConcurrentLinkedDeque<>();
|
||||
public AbstractFarWorldRenderer(int geometrySize, int maxSections) {
|
||||
@@ -96,7 +98,7 @@ public abstract class AbstractFarWorldRenderer <T extends Viewport> {
|
||||
}
|
||||
|
||||
//Upload any new geometry
|
||||
this.geometry.uploadResults();
|
||||
this.updatedSectionIds = this.geometry.uploadResults();
|
||||
{
|
||||
boolean didHaveBiomeChange = false;
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ import static org.lwjgl.opengl.GL42.*;
|
||||
import static org.lwjgl.opengl.GL42.GL_FRAMEBUFFER_BARRIER_BIT;
|
||||
import static org.lwjgl.opengl.GL43.*;
|
||||
import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_BUFFER;
|
||||
import static org.lwjgl.opengl.GL45C.glBindTextureUnit;
|
||||
import static org.lwjgl.opengl.GL45C.glClearNamedBufferData;
|
||||
import static org.lwjgl.opengl.GL45.glBindTextureUnit;
|
||||
import static org.lwjgl.opengl.GL45.glClearNamedBufferData;
|
||||
|
||||
public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer<Gl46Viewport> {
|
||||
private final Shader commandGen = Shader.make()
|
||||
@@ -104,6 +104,13 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer<Gl46Viewport>
|
||||
return;
|
||||
}
|
||||
|
||||
{//Mark all of the updated sections as being visible from last frame
|
||||
for (int id : this.updatedSectionIds) {
|
||||
long ptr = UploadStream.INSTANCE.upload(viewport.visibilityBuffer, id * 4L, 4);
|
||||
MemoryUtil.memPutInt(ptr, viewport.frameId - 1);//(visible from last frame)
|
||||
}
|
||||
}
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user