Tweeks and fixes
This commit is contained in:
@@ -28,7 +28,7 @@ public class DistanceTracker {
|
|||||||
this.minYSection = MinecraftClient.getInstance().world.getBottomSectionCoord()/2;
|
this.minYSection = MinecraftClient.getInstance().world.getBottomSectionCoord()/2;
|
||||||
this.maxYSection = MinecraftClient.getInstance().world.getTopSectionCoord()/2;
|
this.maxYSection = MinecraftClient.getInstance().world.getTopSectionCoord()/2;
|
||||||
|
|
||||||
if (false) {
|
if (true) {
|
||||||
this.rings[0] = new TransitionRing2D(5, MinecraftClient.getInstance().options.getViewDistance().getValue() / 2, (x, z) -> {
|
this.rings[0] = new TransitionRing2D(5, MinecraftClient.getInstance().options.getViewDistance().getValue() / 2, (x, z) -> {
|
||||||
for (int y = this.minYSection; y <= this.maxYSection; y++) {
|
for (int y = this.minYSection; y <= this.maxYSection; y++) {
|
||||||
this.tracker.remLvl0(x, y, z);
|
this.tracker.remLvl0(x, y, z);
|
||||||
|
|||||||
@@ -439,12 +439,32 @@ public class ModelManager {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO:FIXME: if the model is not already in the cache for some reason it renders black, need to figure out why
|
||||||
public long getModelMetadata(int blockId) {
|
public long getModelMetadata(int blockId) {
|
||||||
int map = this.idMappings[blockId];
|
int map = 0;
|
||||||
|
while ((map = this.idMappings[blockId]) == -1) {
|
||||||
|
Thread.onSpinWait();
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (map == -1) {
|
if (map == -1) {
|
||||||
throw new IllegalArgumentException("Id hasnt been computed yet: " + blockId);
|
throw new IllegalArgumentException("Id hasnt been computed yet: " + blockId);
|
||||||
}
|
}
|
||||||
return this.metadataCache[map];
|
long meta = 0;
|
||||||
|
|
||||||
|
while ((meta = this.metadataCache[map]) == 0) {
|
||||||
|
Thread.onSpinWait();
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getModelId(int blockId) {
|
public int getModelId(int blockId) {
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
|
|||||||
|
|
||||||
RenderLayer.getCutoutMipped().startDrawing();
|
RenderLayer.getCutoutMipped().startDrawing();
|
||||||
int oldActiveTexture = glGetInteger(GL_ACTIVE_TEXTURE);
|
int oldActiveTexture = glGetInteger(GL_ACTIVE_TEXTURE);
|
||||||
int oldBoundTexture = glGetInteger(GL_TEXTURE_BINDING_2D);
|
|
||||||
//RenderSystem.enableBlend();
|
//RenderSystem.enableBlend();
|
||||||
//RenderSystem.defaultBlendFunc();
|
//RenderSystem.defaultBlendFunc();
|
||||||
|
|
||||||
@@ -127,8 +126,9 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
|
|||||||
|
|
||||||
|
|
||||||
//Bind the texture atlas
|
//Bind the texture atlas
|
||||||
glBindSampler(0, this.models.getSamplerId());
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
int oldBoundTexture = glGetInteger(GL_TEXTURE_BINDING_2D);
|
||||||
|
glBindSampler(0, this.models.getSamplerId());
|
||||||
glBindTexture(GL_TEXTURE_2D, this.models.getTextureId());
|
glBindTexture(GL_TEXTURE_2D, this.models.getTextureId());
|
||||||
|
|
||||||
glClearNamedBufferData(this.glCommandCountBuffer.id, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, new int[1]);
|
glClearNamedBufferData(this.glCommandCountBuffer.id, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, new int[1]);
|
||||||
@@ -174,10 +174,10 @@ public class Gl46FarWorldRenderer extends AbstractFarWorldRenderer {
|
|||||||
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
int oldActiveTexture = glGetInteger(GL_ACTIVE_TEXTURE);
|
int oldActiveTexture = glGetInteger(GL_ACTIVE_TEXTURE);
|
||||||
int oldBoundTexture = glGetInteger(GL_TEXTURE_BINDING_2D);
|
|
||||||
|
|
||||||
glBindSampler(0, this.models.getSamplerId());
|
glBindSampler(0, this.models.getSamplerId());
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
int oldBoundTexture = glGetInteger(GL_TEXTURE_BINDING_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, this.models.getTextureId());
|
glBindTexture(GL_TEXTURE_2D, this.models.getTextureId());
|
||||||
this.lodShader.bind();
|
this.lodShader.bind();
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ public class WorldImporter {
|
|||||||
biomes,
|
biomes,
|
||||||
(bx, by, bz, state) -> {
|
(bx, by, bz, state) -> {
|
||||||
int block = 0;
|
int block = 0;
|
||||||
int sky = 15;//since sky is inverted
|
int sky = 0;
|
||||||
if (blockLight != null) {
|
if (blockLight != null) {
|
||||||
block = blockLight.get(bx, by, bz);
|
block = blockLight.get(bx, by, bz);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
public class MixinSodiumWorldRender {
|
public class MixinSodiumWorldRender {
|
||||||
@Inject(method = "drawChunkLayer", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "drawChunkLayer", at = @At("HEAD"), cancellable = true)
|
||||||
private void cancelRender(RenderLayer renderLayer, MatrixStack matrixStack, double x, double y, double z, CallbackInfo ci) {
|
private void cancelRender(RenderLayer renderLayer, MatrixStack matrixStack, double x, double y, double z, CallbackInfo ci) {
|
||||||
ci.cancel();
|
//ci.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ void main() {
|
|||||||
ivec3 pos = (((ipos<<detail)-baseSectionPos)<<5);
|
ivec3 pos = (((ipos<<detail)-baseSectionPos)<<5);
|
||||||
pos += aabbOffset;
|
pos += aabbOffset;
|
||||||
pos -= (1<<detail);
|
pos -= (1<<detail);
|
||||||
pos += (ivec3(gl_VertexID&1, (gl_VertexID>>2)&1, (gl_VertexID>>1)&1)*(size+1))*(1<<detail);
|
pos += (ivec3(gl_VertexID&1, (gl_VertexID>>2)&1, (gl_VertexID>>1)&1)*(size+2))*(1<<detail);
|
||||||
|
|
||||||
gl_Position = MVP * vec4(vec3(pos),1);
|
gl_Position = MVP * vec4(vec3(pos),1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user