22w16g improved occlusion query stability (reduced "chunk flickering")
This commit is contained in:
parent
df09eb33b5
commit
03d4511523
91417
javascript/classes.js
91417
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 = "22w16f";
|
public static final String version = "22w16g";
|
||||||
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";
|
||||||
|
|
|
@ -1098,19 +1098,12 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
|
||||||
|
|
||||||
public static final void glDrawOcclusionBB(float posX, float posY, float posZ, float sizeX, float sizeY, float sizeZ) {
|
public static final void glDrawOcclusionBB(float posX, float posY, float posZ, float sizeX, float sizeY, float sizeZ) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(posX - sizeX * 0.0001f, posY - sizeY * 0.0001f, posZ - sizeZ * 0.0001f);
|
glTranslatef(posX - sizeX * 0.01f, posY - sizeY * 0.01f, posZ - sizeZ * 0.01f);
|
||||||
glScalef(sizeX * 1.0002f, sizeY * 1.0002f, sizeZ * 1.0002f);
|
glScalef(sizeX * 1.02f, sizeY * 1.02f, sizeZ * 1.02f);
|
||||||
matModelV[matModelPointer].store(occlusionModel);
|
matModelV[matModelPointer].store(occlusionModel);
|
||||||
_wglUniformMat4fv(occlusion_matrix_m, occlusionModel);
|
_wglUniformMat4fv(occlusion_matrix_m, occlusionModel);
|
||||||
_wglDrawArrays(_wGL_TRIANGLES, 0, 36);
|
_wglDrawArrays(_wGL_TRIANGLES, 0, 36);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
//glPushMatrix();
|
|
||||||
//glTranslatef(posX + sizeX * 0.0001f, posY + sizeY * 0.0001f, posZ + sizeZ * 0.0001f);
|
|
||||||
//glScalef(sizeX * 0.9998f, sizeY * 0.9998f, sizeZ * 0.9998f);
|
|
||||||
//matModelV[matModelPointer].store(occlusionModel);
|
|
||||||
//_wglUniformMat4fv(occlusion_matrix_m, occlusionModel);
|
|
||||||
//_wglDrawArrays(_wGL_TRIANGLES, 0, 36);
|
|
||||||
//glPopMatrix();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@ public class GuiMainMenu extends GuiScreen {
|
||||||
int x = (this.width - 345) / 2;
|
int x = (this.width - 345) / 2;
|
||||||
int y = (this.height - 230) / 2;
|
int y = (this.height - 230) / 2;
|
||||||
if(par1 >= (x + 323) && par1 <= (x + 323 + 13) && par2 >= (y + 7) && par2 <= (y + 7 + 13)) {
|
if(par1 >= (x + 323) && par1 <= (x + 323 + 13) && par2 >= (y + 7) && par2 <= (y + 7 + 13)) {
|
||||||
|
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
hideAck();
|
hideAck();
|
||||||
}
|
}
|
||||||
int trackHeight = 193;
|
int trackHeight = 193;
|
||||||
|
|
|
@ -156,7 +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.occlusionQueryStalled = new long[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);
|
||||||
|
@ -504,7 +504,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
|
|
||||||
private long lastOcclusionQuery = 0l;
|
private long lastOcclusionQuery = 0l;
|
||||||
private boolean[] occlusionQueryAvailable;
|
private boolean[] occlusionQueryAvailable;
|
||||||
private boolean[] occlusionQueryStalled;
|
private long[] occlusionQueryStalled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts all renderers based on the passed in entity. Args: entityLiving,
|
* Sorts all renderers based on the passed in entity. Args: entityLiving,
|
||||||
|
@ -562,6 +562,10 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
byte var17 = 0;
|
byte var17 = 0;
|
||||||
int var34;
|
int var34;
|
||||||
|
|
||||||
|
long queryRate = 50l;
|
||||||
|
long stallRate = 150l;
|
||||||
|
|
||||||
|
long ct = System.currentTimeMillis();
|
||||||
if(par2 == 0) {
|
if(par2 == 0) {
|
||||||
this.theWorld.theProfiler.endStartSection("getoccl");
|
this.theWorld.theProfiler.endStartSection("getoccl");
|
||||||
for (int i = 0; i < this.sortedWorldRenderers.length; ++i) {
|
for (int i = 0; i < this.sortedWorldRenderers.length; ++i) {
|
||||||
|
@ -571,14 +575,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]) {
|
}else if(!c.skipAllRenderPasses() && c.isInFrustum) {
|
||||||
if(EaglerAdapter.glGetQueryResultAvailable(glOcclusionQuery[c.chunkIndex])) {
|
if(occlusionQueryAvailable[c.chunkIndex] && 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]) {
|
occlusionQueryStalled[c.chunkIndex] = 0l;
|
||||||
|
}else if(occlusionQueryStalled[c.chunkIndex] != 0l && ct - occlusionQueryStalled[c.chunkIndex] > stallRate) {
|
||||||
c.isVisible = true;
|
c.isVisible = true;
|
||||||
}
|
}
|
||||||
occlusionQueryStalled[c.chunkIndex] = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -588,8 +592,8 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
|
|
||||||
var7 -= par1EntityLiving.getEyeHeight();
|
var7 -= par1EntityLiving.getEyeHeight();
|
||||||
|
|
||||||
long ct = System.currentTimeMillis();
|
ct = System.currentTimeMillis();
|
||||||
if(par2 == 0 && ct - lastOcclusionQuery > 50l) {
|
if(par2 == 0 && ct - lastOcclusionQuery > queryRate) {
|
||||||
lastOcclusionQuery = ct;
|
lastOcclusionQuery = ct;
|
||||||
this.theWorld.theProfiler.endStartSection("occl");
|
this.theWorld.theProfiler.endStartSection("occl");
|
||||||
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
|
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
|
||||||
|
@ -603,11 +607,17 @@ 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)) {
|
||||||
|
boolean stalled = false;
|
||||||
if(occlusionQueryAvailable[c.chunkIndex]) {
|
if(occlusionQueryAvailable[c.chunkIndex]) {
|
||||||
occlusionQueryStalled[c.chunkIndex] = true;
|
if(occlusionQueryStalled[c.chunkIndex] == 0l) {
|
||||||
}else {
|
occlusionQueryStalled[c.chunkIndex] = ct;
|
||||||
occlusionQueryAvailable[c.chunkIndex] = true;
|
stalled = true;
|
||||||
|
}else if(ct - occlusionQueryStalled[c.chunkIndex] < stallRate) {
|
||||||
|
stalled = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(!stalled) {
|
||||||
|
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();
|
||||||
|
@ -617,6 +627,7 @@ public class RenderGlobal implements IWorldAccess {
|
||||||
EaglerAdapter.glEndQuery();
|
EaglerAdapter.glEndQuery();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
EaglerAdapter.glEndOcclusionBB();
|
EaglerAdapter.glEndOcclusionBB();
|
||||||
EaglerAdapter.glColorMask(true, true, true, true);
|
EaglerAdapter.glColorMask(true, true, true, true);
|
||||||
EaglerAdapter.glDepthMask(true);
|
EaglerAdapter.glDepthMask(true);
|
||||||
|
|
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 New Issue
Block a user