tinker
This commit is contained in:
@@ -66,11 +66,13 @@ public class ChunkBoundRenderer {
|
||||
//Bind and render, changing as little gl state as possible so that the caller may configure how it wants to render
|
||||
public void render(Viewport<?> viewport) {
|
||||
if (!this.remQueue.isEmpty()) {
|
||||
boolean wasEmpty = this.chunk2idx.isEmpty();
|
||||
this.remQueue.forEach(this::_remPos);
|
||||
this.remQueue.clear();
|
||||
if (this.chunk2idx.isEmpty()&&!wasEmpty) {//When going from stuff to nothing need to clear the depth buffer
|
||||
glClearNamedFramebufferfv(this.frameBuffer.id, GL_DEPTH, 0, new float[]{0});
|
||||
}
|
||||
}
|
||||
|
||||
if (this.chunk2idx.isEmpty() && this.addQueue.isEmpty()) return;
|
||||
|
||||
if (this.depthBuffer.getWidth() != viewport.width || this.depthBuffer.getHeight() != viewport.height) {
|
||||
this.depthBuffer.free();
|
||||
@@ -78,6 +80,8 @@ public class ChunkBoundRenderer {
|
||||
this.frameBuffer.bind(GL_DEPTH_ATTACHMENT, this.depthBuffer).verify();
|
||||
}
|
||||
|
||||
if (this.chunk2idx.isEmpty() && this.addQueue.isEmpty()) return;
|
||||
|
||||
long ptr = UploadStream.INSTANCE.upload(this.uniformBuffer, 0, 128);
|
||||
long matPtr = ptr; ptr += 4*4*4;
|
||||
{//This is recomputed to be in chunk section space not worldsection
|
||||
|
||||
@@ -25,13 +25,19 @@ void main() {
|
||||
discard;
|
||||
}
|
||||
vec2 uv = mod(uv, vec2(1.0))*(1.0/(vec2(3.0,2.0)*256.0));
|
||||
vec2 texPos = uv + baseUV;
|
||||
//vec4 colour = solidColour;
|
||||
vec4 colour = texture(blockModelAtlas, uv + baseUV, ((flags>>1)&1u)*-4.0);
|
||||
vec4 colour = texture(blockModelAtlas, texPos, ((flags>>1)&1u)*-5.0);//TODO: FIXME mipping needs to be fixed so that it doesnt go cross model bounds
|
||||
//Also, small quad is really fking over the mipping level somehow
|
||||
if ((flags&1u) == 1 && colour.a <= 0.25f) {
|
||||
//This is stupidly stupidly bad for divergence
|
||||
//TODO: FIXME, basicly what this do is sample the exact pixel (no lod) for discarding, this stops mipmapping fucking it over
|
||||
if (texture(blockModelAtlas, texPos, -4.0).a <= 0.1f) {
|
||||
#ifndef DEBUG_RENDER
|
||||
discard;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//Conditional tinting, TODO: FIXME: REPLACE WITH MASK OR SOMETHING, like encode data into the top bit of alpha
|
||||
if ((flags&(1u<<2)) != 0 && abs(colour.r-colour.g) < 0.02f && abs(colour.g-colour.b) < 0.02f) {
|
||||
|
||||
@@ -42,7 +42,7 @@ vec4 uint2vec4RGBA(uint colour) {
|
||||
}
|
||||
|
||||
vec4 getFaceSize(uint faceData) {
|
||||
float EPSILON = 0.001f;
|
||||
float EPSILON = 0.0005f;
|
||||
|
||||
vec4 faceOffsetsSizes = extractFaceSizes(faceData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user