misc
This commit is contained in:
@@ -79,4 +79,8 @@ public class VoxyConfig implements OptionStorage<VoxyConfig> {
|
|||||||
public VoxyConfig getData() {
|
public VoxyConfig getData() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRenderingEnabled() {
|
||||||
|
return VoxyCommon.isAvailable() && this.enabled && this.enableRendering;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public class GlViewCapture {
|
|||||||
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 3, buffer, offset, (this.width*3L)*(this.height*2L)*4L*2);//its 2*4 because colour + depth stencil
|
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 3, buffer, offset, (this.width*3L)*(this.height*2L)*4L*2);//its 2*4 because colour + depth stencil
|
||||||
glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT|GL_TEXTURE_UPDATE_BARRIER_BIT|GL_PIXEL_BUFFER_BARRIER_BIT|GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);//Am not sure if barriers are right
|
glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT|GL_TEXTURE_UPDATE_BARRIER_BIT|GL_PIXEL_BUFFER_BARRIER_BIT|GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);//Am not sure if barriers are right
|
||||||
glDispatchCompute(3, 2, 1);
|
glDispatchCompute(3, 2, 1);
|
||||||
|
glBindBufferRange(GL_SHADER_STORAGE_BUFFER, 3, 0, 0, 4);//WHY DOES THIS FIX FUCKING BINDING ISSUES HERE WHEN DOING THIS IN THE RENDER SYSTEM DOESNT
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
|
|||||||
@@ -242,6 +242,7 @@ public class ModelTextureBakery {
|
|||||||
}
|
}
|
||||||
glBindVertexArray(0);
|
glBindVertexArray(0);
|
||||||
} else {//Is fluid, slow path :(
|
} else {//Is fluid, slow path :(
|
||||||
|
|
||||||
if (!(state.getBlock() instanceof FluidBlock)) throw new IllegalStateException();
|
if (!(state.getBlock() instanceof FluidBlock)) throw new IllegalStateException();
|
||||||
|
|
||||||
var mat = new Matrix4f();
|
var mat = new Matrix4f();
|
||||||
@@ -300,6 +301,7 @@ public class ModelTextureBakery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//"Restore" gl state
|
//"Restore" gl state
|
||||||
glViewport(viewdat[0], viewdat[1], viewdat[2], viewdat[3]);
|
glViewport(viewdat[0], viewdat[1], viewdat[2], viewdat[3]);
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class MDICViewport extends Viewport<MDICViewport> {
|
|||||||
public final GlBuffer drawCountCallBuffer = new GlBuffer(1024).zero();
|
public final GlBuffer drawCountCallBuffer = new GlBuffer(1024).zero();
|
||||||
public final GlBuffer drawCallBuffer = new GlBuffer(5*4*(400_000+100_000+100_000)).zero();//400k draw calls
|
public final GlBuffer drawCallBuffer = new GlBuffer(5*4*(400_000+100_000+100_000)).zero();//400k draw calls
|
||||||
public final GlBuffer positionScratchBuffer = new GlBuffer(8*400000).zero();//400k positions
|
public final GlBuffer positionScratchBuffer = new GlBuffer(8*400000).zero();//400k positions
|
||||||
public final GlBuffer indirectLookupBuffer = new GlBuffer(HierarchicalOcclusionTraverser.MAX_QUEUE_SIZE *4+4);
|
public final GlBuffer indirectLookupBuffer = new GlBuffer(HierarchicalOcclusionTraverser.MAX_QUEUE_SIZE *4+4);//In theory, this could be global/not unique to the viewport
|
||||||
public final GlBuffer visibilityBuffer;
|
public final GlBuffer visibilityBuffer;
|
||||||
|
|
||||||
public MDICViewport(int maxSectionCount) {
|
public MDICViewport(int maxSectionCount) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
|
|
||||||
@Mixin(ClientPlayNetworkHandler.class)
|
@Mixin(ClientPlayNetworkHandler.class)
|
||||||
public class MixinClientLoginNetworkHandler {
|
public class MixinClientLoginNetworkHandler {
|
||||||
@Inject(method = "onGameJoin", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerInteractionManager;<init>(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/network/ClientPlayNetworkHandler;)V", shift = At.Shift.BY, by = 2))
|
@Inject(method = "onGameJoin", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/s2c/play/GameJoinS2CPacket;commonPlayerSpawnInfo()Lnet/minecraft/network/packet/s2c/play/CommonPlayerSpawnInfo;"))
|
||||||
private void voxy$init(GameJoinS2CPacket packet, CallbackInfo ci) {
|
private void voxy$init(GameJoinS2CPacket packet, CallbackInfo ci) {
|
||||||
if (VoxyCommon.isAvailable()) {
|
if (VoxyCommon.isAvailable()) {
|
||||||
VoxyClientInstance.isInGame = true;
|
VoxyClientInstance.isInGame = true;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public abstract class MixinWorldRenderer implements IGetVoxyRenderSystem {
|
|||||||
@Override
|
@Override
|
||||||
public void createRenderer() {
|
public void createRenderer() {
|
||||||
if (this.renderer != null) throw new IllegalStateException("Cannot have multiple renderers");
|
if (this.renderer != null) throw new IllegalStateException("Cannot have multiple renderers");
|
||||||
if ((!VoxyConfig.CONFIG.enableRendering)||(!VoxyConfig.CONFIG.enabled)) {
|
if (!VoxyConfig.CONFIG.isRenderingEnabled()) {
|
||||||
Logger.info("Not creating renderer due to disabled");
|
Logger.info("Not creating renderer due to disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,9 +96,11 @@ public class VoxelIngestService {
|
|||||||
boolean gotLighting = false;
|
boolean gotLighting = false;
|
||||||
|
|
||||||
int i = chunk.getBottomSectionCoord() - 1;
|
int i = chunk.getBottomSectionCoord() - 1;
|
||||||
|
boolean allEmpty = true;
|
||||||
for (var section : chunk.getSectionArray()) {
|
for (var section : chunk.getSectionArray()) {
|
||||||
i++;
|
i++;
|
||||||
if (section == null || !shouldIngestSection(section, chunk.getPos().x, i, chunk.getPos().z)) continue;
|
if (section == null || !shouldIngestSection(section, chunk.getPos().x, i, chunk.getPos().z)) continue;
|
||||||
|
allEmpty&=section.isEmpty();
|
||||||
//if (section.isEmpty()) continue;
|
//if (section.isEmpty()) continue;
|
||||||
var pos = ChunkSectionPos.from(chunk.getPos(), i);
|
var pos = ChunkSectionPos.from(chunk.getPos(), i);
|
||||||
if (lightingProvider.getStatus(LightType.SKY, pos) != LightStorage.Status.LIGHT_AND_DATA && lightingProvider.getStatus(LightType.BLOCK, pos) != LightStorage.Status.LIGHT_AND_DATA)
|
if (lightingProvider.getStatus(LightType.SKY, pos) != LightStorage.Status.LIGHT_AND_DATA && lightingProvider.getStatus(LightType.BLOCK, pos) != LightStorage.Status.LIGHT_AND_DATA)
|
||||||
@@ -106,6 +108,22 @@ public class VoxelIngestService {
|
|||||||
gotLighting = true;
|
gotLighting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (allEmpty&&!gotLighting) {
|
||||||
|
//Special case all empty chunk columns, we need to clear it out
|
||||||
|
i = chunk.getBottomSectionCoord() - 1;
|
||||||
|
for (var section : chunk.getSectionArray()) {
|
||||||
|
i++;
|
||||||
|
if (section == null || !shouldIngestSection(section, chunk.getPos().x, i, chunk.getPos().z)) continue;
|
||||||
|
this.ingestQueue.add(new IngestSection(chunk.getPos().x, i, chunk.getPos().z, engine, section, null, null));
|
||||||
|
try {
|
||||||
|
this.threads.execute();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.error("Executing had an error: assume shutting down, aborting",e);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!gotLighting) {
|
if (!gotLighting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ float projDepth(vec3 pos) {
|
|||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
float depth = texture(depthTex, UV.xy).r;
|
float depth = texture(depthTex, UV.xy).r;
|
||||||
if (depth == 0.0f) {
|
if (depth == 0.0f || depth == 1.0) {
|
||||||
discard;
|
discard;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
out vec2 UV;
|
out vec2 UV;
|
||||||
void main() {
|
void main() {
|
||||||
gl_Position = vec4(vec2(gl_VertexID&1, (gl_VertexID>>1)&1) * 4 - 1, 1f, 1);
|
gl_Position = vec4(vec2(gl_VertexID&1, (gl_VertexID>>1)&1) * 4 - 1, 1.0f, 1);
|
||||||
UV = gl_Position.xy*0.5+0.5;
|
UV = gl_Position.xy*0.5+0.5;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user