22w16f improved occlusion query stability under lag
This commit is contained in:
parent
7659bc095d
commit
df09eb33b5
9 changed files with 63451 additions and 63429 deletions
98079
javascript/classes.js
98079
javascript/classes.js
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ public class ConfigConstants {
|
||||||
|
|
||||||
public static boolean profanity = false;
|
public static boolean profanity = false;
|
||||||
|
|
||||||
public static final String version = "22w16e";
|
public static final String version = "22w16f";
|
||||||
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";
|
||||||
|
|
|
@ -156,6 +156,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
this.glOcclusionQuery[i] = -1;
|
this.glOcclusionQuery[i] = -1;
|
||||||
}
|
}
|
||||||
this.occlusionQueryAvailable = new boolean[glOcclusionQuery.length];
|
this.occlusionQueryAvailable = new boolean[glOcclusionQuery.length];
|
||||||
|
this.occlusionQueryStalled = new boolean[occlusionQueryAvailable.length];
|
||||||
this.starGLCallList = GLAllocation.generateDisplayLists(3);
|
this.starGLCallList = GLAllocation.generateDisplayLists(3);
|
||||||
EaglerAdapter.glPushMatrix();
|
EaglerAdapter.glPushMatrix();
|
||||||
EaglerAdapter.glNewList(this.starGLCallList, EaglerAdapter.GL_COMPILE);
|
EaglerAdapter.glNewList(this.starGLCallList, EaglerAdapter.GL_COMPILE);
|
||||||
|
@ -503,6 +504,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
|
|
||||||
private long lastOcclusionQuery = 0l;
|
private long lastOcclusionQuery = 0l;
|
||||||
private boolean[] occlusionQueryAvailable;
|
private boolean[] occlusionQueryAvailable;
|
||||||
|
private boolean[] occlusionQueryStalled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts all renderers based on the passed in entity. Args: entityLiving,
|
* Sorts all renderers based on the passed in entity. Args: entityLiving,
|
||||||
|
@ -569,9 +571,14 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
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.isVisible = true;
|
||||||
}else if(!c.skipAllRenderPasses() && c.isInFrustum && occlusionQueryAvailable[c.chunkIndex] && EaglerAdapter.glGetQueryResultAvailable(glOcclusionQuery[c.chunkIndex])) {
|
}else if(!c.skipAllRenderPasses() && c.isInFrustum && occlusionQueryAvailable[c.chunkIndex]) {
|
||||||
|
if(EaglerAdapter.glGetQueryResultAvailable(glOcclusionQuery[c.chunkIndex])) {
|
||||||
c.isVisible = EaglerAdapter.glGetQueryResult(glOcclusionQuery[c.chunkIndex]);
|
c.isVisible = EaglerAdapter.glGetQueryResult(glOcclusionQuery[c.chunkIndex]);
|
||||||
occlusionQueryAvailable[c.chunkIndex] = false;
|
occlusionQueryAvailable[c.chunkIndex] = false;
|
||||||
|
}else if(occlusionQueryStalled[c.chunkIndex]) {
|
||||||
|
c.isVisible = true;
|
||||||
|
}
|
||||||
|
occlusionQueryStalled[c.chunkIndex] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -596,7 +603,11 @@ 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(!c.skipAllRenderPasses() && c.isInFrustum && !(ccx < 2 && ccx > -2 && ccy < 2 && ccy > -2 && ccz < 2 && ccz > -2)) {
|
if(!c.skipAllRenderPasses() && c.isInFrustum && !(ccx < 2 && ccx > -2 && ccy < 2 && ccy > -2 && ccz < 2 && ccz > -2)) {
|
||||||
|
if(occlusionQueryAvailable[c.chunkIndex]) {
|
||||||
|
occlusionQueryStalled[c.chunkIndex] = true;
|
||||||
|
}else {
|
||||||
occlusionQueryAvailable[c.chunkIndex] = true;
|
occlusionQueryAvailable[c.chunkIndex] = true;
|
||||||
|
}
|
||||||
int q = glOcclusionQuery[c.chunkIndex];
|
int q = glOcclusionQuery[c.chunkIndex];
|
||||||
if(q == -1) {
|
if(q == -1) {
|
||||||
q = glOcclusionQuery[c.chunkIndex] = EaglerAdapter.glCreateQuery();
|
q = glOcclusionQuery[c.chunkIndex] = EaglerAdapter.glCreateQuery();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue