Attempt fix for lighting

This commit is contained in:
mcrcortex
2024-03-26 14:22:01 +10:00
parent fecbef2510
commit 52c7250d5a
3 changed files with 7 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ package me.cortex.voxy.client.core.rendering;
import me.cortex.voxy.client.core.gl.GlBuffer; import me.cortex.voxy.client.core.gl.GlBuffer;
import me.cortex.voxy.client.core.gl.shader.Shader; import me.cortex.voxy.client.core.gl.shader.Shader;
import me.cortex.voxy.client.core.gl.shader.ShaderType; import me.cortex.voxy.client.core.gl.shader.ShaderType;
import me.cortex.voxy.client.core.rendering.util.DownloadStream;
import me.cortex.voxy.client.core.rendering.util.UploadStream; import me.cortex.voxy.client.core.rendering.util.UploadStream;
import me.cortex.voxy.client.mixin.joml.AccessFrustumIntersection; import me.cortex.voxy.client.mixin.joml.AccessFrustumIntersection;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@@ -149,15 +150,16 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer<Gl46Viewport>
/* /*
glFinish();
DownloadStream.INSTANCE.download(this.glCommandCountBuffer, 0, 4, (ptr, siz) -> { DownloadStream.INSTANCE.download(this.glCommandCountBuffer, 0, 4, (ptr, siz) -> {
int cnt = MemoryUtil.memGetInt(ptr); int cnt = MemoryUtil.memGetInt(ptr);
System.out.println(cnt); drawCnt = cnt;
}); });
DownloadStream.INSTANCE.commit(); DownloadStream.INSTANCE.commit();
*/ */
glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT); glMemoryBarrier(GL_PIXEL_BUFFER_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
this.cullShader.bind(); this.cullShader.bind();

View File

@@ -164,7 +164,7 @@ public class RenderDataFactory {
connectedSection.copyDataTo(this.connectedSectionCache); connectedSection.copyDataTo(this.connectedSectionCache);
connectedSection.release(); connectedSection.release();
} else { } else {
Arrays.fill(this.connectedSectionCache, 0); Arrays.fill(this.connectedSectionCache, Mapper.withLight(Mapper.AIR, 15));
} }
obtainedOppositeSection0 = true; obtainedOppositeSection0 = true;
} }
@@ -190,7 +190,7 @@ public class RenderDataFactory {
connectedSection.copyDataTo(this.connectedSectionCache); connectedSection.copyDataTo(this.connectedSectionCache);
connectedSection.release(); connectedSection.release();
} else { } else {
Arrays.fill(this.connectedSectionCache, 0); Arrays.fill(this.connectedSectionCache, Mapper.withLight(Mapper.AIR, 15));
} }
obtainedOppositeSection31 = true; obtainedOppositeSection31 = true;
} }

View File

@@ -59,7 +59,7 @@ public class ActiveSectionTracker {
} }
if (status == 1) { if (status == 1) {
//We need to set the data to air as it is undefined state //We need to set the data to air as it is undefined state
Arrays.fill(section.data, Mapper.AIR); Arrays.fill(section.data, Mapper.withLight(Mapper.AIR, 15));//Since lighting is inverted
} }
section.acquire(); section.acquire();
holder.obj = section; holder.obj = section;