fixed chunk flickering
This commit is contained in:
parent
03d4511523
commit
3436ffa97c
|
@ -4,7 +4,7 @@ public class ConfigConstants {
|
||||||
|
|
||||||
public static boolean profanity = false;
|
public static boolean profanity = false;
|
||||||
|
|
||||||
public static final String version = "22w16g";
|
public static final String version = "22w16h";
|
||||||
public static final String mainMenuString = "eaglercraft " + version;
|
public static final String mainMenuString = "eaglercraft " + version;
|
||||||
|
|
||||||
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";
|
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";
|
||||||
|
|
|
@ -320,7 +320,8 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
int i = (var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4;
|
int i = (var6 * this.renderChunksTall + var5) * this.renderChunksWide + var4;
|
||||||
this.worldRenderers[i] = new WorldRenderer(this.theWorld, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, this.glRenderListBase + var2);
|
this.worldRenderers[i] = new WorldRenderer(this.theWorld, this.tileEntities, var4 * 16, var5 * 16, var6 * 16, this.glRenderListBase + var2);
|
||||||
this.worldRenderers[i].isWaitingOnOcclusionQuery = false;
|
this.worldRenderers[i].isWaitingOnOcclusionQuery = false;
|
||||||
this.worldRenderers[i].isVisible = true;
|
this.worldRenderers[i].isNowVisible = true;
|
||||||
|
this.worldRenderers[i].isVisible = 100;
|
||||||
this.worldRenderers[i].isInFrustum = true;
|
this.worldRenderers[i].isInFrustum = true;
|
||||||
this.worldRenderers[i].chunkIndex = var3++;
|
this.worldRenderers[i].chunkIndex = var3++;
|
||||||
this.worldRenderers[i].markDirty();
|
this.worldRenderers[i].markDirty();
|
||||||
|
@ -502,6 +503,8 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GOSH FUCKING DAMMIT WHY IN THE FUCK IS GODDAMN WEBGL THIS UNSTABLE
|
||||||
|
|
||||||
private long lastOcclusionQuery = 0l;
|
private long lastOcclusionQuery = 0l;
|
||||||
private boolean[] occlusionQueryAvailable;
|
private boolean[] occlusionQueryAvailable;
|
||||||
private long[] occlusionQueryStalled;
|
private long[] occlusionQueryStalled;
|
||||||
|
@ -563,7 +566,9 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
int var34;
|
int var34;
|
||||||
|
|
||||||
long queryRate = 50l;
|
long queryRate = 50l;
|
||||||
long stallRate = 150l;
|
long stallRateVisible = 50l;
|
||||||
|
long stallRate = 500l;
|
||||||
|
int cooldownRate = 10;
|
||||||
|
|
||||||
long ct = System.currentTimeMillis();
|
long ct = System.currentTimeMillis();
|
||||||
if(par2 == 0) {
|
if(par2 == 0) {
|
||||||
|
@ -574,14 +579,25 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
int ccy = c.chunkY - fy;
|
int ccy = c.chunkY - fy;
|
||||||
int ccz = c.chunkZ - fz;
|
int ccz = c.chunkZ - fz;
|
||||||
if((ccx < 2 && ccx > -2 && ccy < 2 && ccy > -2 && ccz < 2 && ccz > -2) || glOcclusionQuery[c.chunkIndex] == -1) {
|
if((ccx < 2 && ccx > -2 && ccy < 2 && ccy > -2 && ccz < 2 && ccz > -2) || glOcclusionQuery[c.chunkIndex] == -1) {
|
||||||
c.isVisible = true;
|
c.isNowVisible = true;
|
||||||
|
c.isVisible = cooldownRate;
|
||||||
}else if(!c.skipAllRenderPasses() && c.isInFrustum) {
|
}else if(!c.skipAllRenderPasses() && c.isInFrustum) {
|
||||||
if(occlusionQueryAvailable[c.chunkIndex] && EaglerAdapter.glGetQueryResultAvailable(glOcclusionQuery[c.chunkIndex])) {
|
if(occlusionQueryAvailable[c.chunkIndex]) {
|
||||||
c.isVisible = EaglerAdapter.glGetQueryResult(glOcclusionQuery[c.chunkIndex]);
|
if(EaglerAdapter.glGetQueryResultAvailable(glOcclusionQuery[c.chunkIndex])) {
|
||||||
|
if(EaglerAdapter.glGetQueryResult(glOcclusionQuery[c.chunkIndex])) {
|
||||||
|
c.isNowVisible = true;
|
||||||
|
c.isVisible = cooldownRate;
|
||||||
|
}else {
|
||||||
|
if(c.isVisible <= 0) {
|
||||||
|
c.isNowVisible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
occlusionQueryAvailable[c.chunkIndex] = false;
|
occlusionQueryAvailable[c.chunkIndex] = false;
|
||||||
occlusionQueryStalled[c.chunkIndex] = 0l;
|
occlusionQueryStalled[c.chunkIndex] = 0l;
|
||||||
}else if(occlusionQueryStalled[c.chunkIndex] != 0l && ct - occlusionQueryStalled[c.chunkIndex] > stallRate) {
|
}else if(occlusionQueryStalled[c.chunkIndex] != 0l && ct - occlusionQueryStalled[c.chunkIndex] > stallRateVisible) {
|
||||||
c.isVisible = true;
|
c.isNowVisible = true;
|
||||||
|
c.isVisible = cooldownRate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -627,6 +643,9 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
EaglerAdapter.glEndQuery();
|
EaglerAdapter.glEndQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(c.isVisible > 0) {
|
||||||
|
--c.isVisible;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EaglerAdapter.glEndOcclusionBB();
|
EaglerAdapter.glEndOcclusionBB();
|
||||||
EaglerAdapter.glColorMask(true, true, true, true);
|
EaglerAdapter.glColorMask(true, true, true, true);
|
||||||
|
@ -654,14 +673,14 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
++this.renderersSkippingRenderPass;
|
++this.renderersSkippingRenderPass;
|
||||||
} else if (!this.sortedWorldRenderers[var7].isInFrustum) {
|
} else if (!this.sortedWorldRenderers[var7].isInFrustum) {
|
||||||
++this.renderersBeingClipped;
|
++this.renderersBeingClipped;
|
||||||
} else if (!this.sortedWorldRenderers[var7].isVisible) {
|
} else if(!this.sortedWorldRenderers[var7].isNowVisible) {
|
||||||
++this.renderersBeingOccluded;
|
++this.renderersBeingOccluded;
|
||||||
} else {
|
} else {
|
||||||
++this.renderersBeingRendered;
|
++this.renderersBeingRendered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.sortedWorldRenderers[var7].skipRenderPass[par3] && this.sortedWorldRenderers[var7].isInFrustum && this.sortedWorldRenderers[var7].isVisible) {
|
if (!this.sortedWorldRenderers[var7].skipRenderPass[par3] && this.sortedWorldRenderers[var7].isInFrustum && this.sortedWorldRenderers[var7].isNowVisible) {
|
||||||
int var8 = this.sortedWorldRenderers[var7].getGLCallListForPass(par3);
|
int var8 = this.sortedWorldRenderers[var7].getGLCallListForPass(par3);
|
||||||
|
|
||||||
if (var8 >= 0) {
|
if (var8 >= 0) {
|
||||||
|
|
|
@ -63,7 +63,8 @@ public class WorldRenderer {
|
||||||
public int chunkIndex;
|
public int chunkIndex;
|
||||||
|
|
||||||
/** Is this renderer visible according to the occlusion query */
|
/** Is this renderer visible according to the occlusion query */
|
||||||
public boolean isVisible = true;
|
public int isVisible = 0;
|
||||||
|
public boolean isNowVisible = true;
|
||||||
|
|
||||||
/** Is this renderer waiting on the result of the occlusion query */
|
/** Is this renderer waiting on the result of the occlusion query */
|
||||||
public boolean isWaitingOnOcclusionQuery;
|
public boolean isWaitingOnOcclusionQuery;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user