Add CaveCullingHeight + 'Fun' mode into config
This commit is contained in:
@@ -391,13 +391,13 @@ public class LodQuadBuilder {
|
||||
}
|
||||
}
|
||||
long postQuadsCount = getCurrentQuadsCount();
|
||||
if (mergeCount != 0)
|
||||
ApiShared.LOGGER.info("Merged {}/{}({}) quads", mergeCount, preQuadsCount, mergeCount/(double)preQuadsCount);
|
||||
//if (mergeCount != 0)
|
||||
// ApiShared.LOGGER.info("Merged {}/{}({}) quads", mergeCount, preQuadsCount, mergeCount/(double)preQuadsCount);
|
||||
}
|
||||
|
||||
public Iterator<ByteBuffer> makeVertexBuffers() {
|
||||
return new Iterator<ByteBuffer>() {
|
||||
ByteBuffer bb = ByteBuffer.allocateDirect(MAX_QUADS_PER_BUFFER * QUAD_BYTE_SIZE)
|
||||
final ByteBuffer bb = ByteBuffer.allocateDirect(MAX_QUADS_PER_BUFFER * QUAD_BYTE_SIZE)
|
||||
.order(ByteOrder.nativeOrder());
|
||||
int dir = skipEmpty(0);
|
||||
int quad = 0;
|
||||
|
||||
@@ -172,8 +172,9 @@ public class RenderRegion implements AutoCloseable
|
||||
boolean useSkylightCulling = CONFIG.client().graphics().advancedGraphics().getEnableCaveCulling();
|
||||
useSkylightCulling &= !lodDim.dimension.hasCeiling();
|
||||
useSkylightCulling &= lodDim.dimension.hasSkyLight();
|
||||
//TODO: Add config for skyLightCullingBelow
|
||||
int skyLightCullingBelow = 40;
|
||||
int skyLightCullingBelow = CONFIG.client().graphics().advancedGraphics().getCaveCullingHeight();
|
||||
// FIXME: Clamp also to the max world height.
|
||||
skyLightCullingBelow = Math.max(skyLightCullingBelow, LodBuilder.MIN_WORLD_HEIGHT);
|
||||
LodQuadBuilder builder = new LodQuadBuilder(10, useSkylightCulling, skyLightCullingBelow);
|
||||
Runnable buildRun = ()->{
|
||||
makeLodRenderData(builder, region, adjRegions, playerPosX, playerPosZ);
|
||||
@@ -276,7 +277,7 @@ public class RenderRegion implements AutoCloseable
|
||||
int chunkX = LevelPosUtil.getChunkPos(detailLevel, posX);
|
||||
int chunkZ = LevelPosUtil.getChunkPos(detailLevel, posZ);
|
||||
// skip any chunks that Minecraft is going to render
|
||||
if (chunkGrid.get(chunkX, chunkZ) != null) continue;
|
||||
if (chunkGrid != null && chunkGrid.get(chunkX, chunkZ) != null) continue;
|
||||
}
|
||||
|
||||
long[] posData = region.getAllData(detailLevel, posX, posZ);
|
||||
@@ -308,7 +309,7 @@ public class RenderRegion implements AutoCloseable
|
||||
int zAdj = posZ + lodDirection.getNormal().z;
|
||||
int chunkXAdj = LevelPosUtil.getChunkPos(detailLevel, xAdj);
|
||||
int chunkZAdj = LevelPosUtil.getChunkPos(detailLevel, zAdj);
|
||||
if (chunkGrid.get(chunkXAdj, chunkZAdj)!=null) {
|
||||
if (chunkGrid != null && chunkGrid.get(chunkXAdj, chunkZAdj)!=null) {
|
||||
adjUseBlack[lodDirection.ordinal()-2] = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ import com.seibel.lod.core.wrapperInterfaces.world.IWorldWrapper;
|
||||
public class LodRenderer
|
||||
{
|
||||
public static final boolean ENABLE_DRAW_LAG_SPIKE_LOGGING = false;
|
||||
public static final boolean ENABLE_DUMP_GL_STATE = false;
|
||||
public static final long DRAW_LAG_SPIKE_THRESOLD_NS = TimeUnit.NANOSECONDS.convert(20, TimeUnit.MILLISECONDS);
|
||||
|
||||
public static class LagSpikeCatcher {
|
||||
@@ -133,6 +134,7 @@ public class LodRenderer
|
||||
public static SpamReducedLogger tickLogger = new SpamReducedLogger(1);
|
||||
|
||||
public static void dumpGLState(String str) {
|
||||
if (!ENABLE_DUMP_GL_STATE) return;
|
||||
int currentProgram = GL32.glGetInteger(GL32.GL_CURRENT_PROGRAM);
|
||||
int currentVBO = GL32.glGetInteger(GL32.GL_ARRAY_BUFFER_BINDING);
|
||||
int currentVAO = GL32.glGetInteger(GL32.GL_VERTEX_ARRAY_BINDING);
|
||||
@@ -374,7 +376,7 @@ public class LodRenderer
|
||||
}
|
||||
dumpGLState("Post Lod Draw Before Cleanup");
|
||||
//if (drawCall==0)
|
||||
tickLogger.info("DrawCall Count: {}", drawCount);
|
||||
// tickLogger.info("DrawCall Count: {}", drawCount);
|
||||
|
||||
//================//
|
||||
// render cleanup //
|
||||
@@ -476,11 +478,18 @@ public class LodRenderer
|
||||
//Create a copy of the current matrix, so the current matrix isn't modified.
|
||||
Mat4f lodProj = projMat.copy();
|
||||
|
||||
float nearClipPlane;
|
||||
if (CONFIG.client().advanced().getLodOnlyMode()) {
|
||||
nearClipPlane = 0.1f;
|
||||
} else if (CONFIG.client().graphics().advancedGraphics().getUseExtendedNearClipPlane()) {
|
||||
nearClipPlane = Math.min((vanillaBlockRenderedDistance-16f),8f*16f);
|
||||
} else {
|
||||
nearClipPlane = 16f;
|
||||
}
|
||||
|
||||
//Set new far and near clip plane values.
|
||||
lodProj.setClipPlanes(
|
||||
calculateNearClipPlane(
|
||||
CONFIG.client().graphics().advancedGraphics().getUseExtendedNearClipPlane() ?
|
||||
Math.min((vanillaBlockRenderedDistance-16),8*8) : 16, partialTicks),
|
||||
calculateNearClipPlane(nearClipPlane, partialTicks),
|
||||
(float)((farPlaneBlockDistance+LodUtil.REGION_WIDTH) * Math.sqrt(2)));
|
||||
|
||||
lodProj.multiply(modelMat);
|
||||
@@ -532,7 +541,8 @@ public class LodRenderer
|
||||
private boolean updateVanillaRenderedChunks(LodDimension lodDim) {
|
||||
// if the player is high enough, draw all LODs
|
||||
IWorldWrapper world = MC.getWrappedClientWorld();
|
||||
if (lastUpdatedPos.getY() > world.getHeight()-world.getMinHeight()) {
|
||||
if (lastUpdatedPos.getY() > world.getHeight()-world.getMinHeight() ||
|
||||
CONFIG.client().advanced().getLodOnlyMode()) {
|
||||
if (vanillaChunks != null) {
|
||||
vanillaChunks = null;
|
||||
return true;
|
||||
|
||||
+19
@@ -548,6 +548,12 @@ public interface ILodConfigWrapperSingleton extends IBindable
|
||||
+ " does not have a ceiling. \n";
|
||||
boolean getEnableCaveCulling();
|
||||
void setEnableCaveCulling(boolean newEnableCaveCulling);
|
||||
|
||||
MinDefaultMax<Integer> CAVE_CULLING_HEIGHT_MIN_DEFAULT_MAX = new MinDefaultMax<>(-4096,40,4096);
|
||||
String CAVE_CULLING_HEIGHT_DESC = ""
|
||||
+ " At what Y value should cave culling start? \n";
|
||||
int getCaveCullingHeight();
|
||||
void setCaveCullingHeight(int newCaveCullingHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -875,6 +881,19 @@ public interface ILodConfigWrapperSingleton extends IBindable
|
||||
BufferRebuildTimes getRebuildTimes();
|
||||
void setRebuildTimes(BufferRebuildTimes newBufferRebuildTimes);
|
||||
}
|
||||
|
||||
boolean LOD_ONLY_MODE_DEFAULT = false;
|
||||
String LOD_ONLY_MODE_DESC = ""
|
||||
+ " Due to some demand for playing without vanilla terrains, \n"
|
||||
+ " we decided to add this mode for fun. \n"
|
||||
+ "\n"
|
||||
+ " NOTE: Do not report any issues when this mode is on! \n"
|
||||
+ " Again, this setting is only for fun, and mod \n"
|
||||
+ " compatibility is not guaranteed. \n"
|
||||
+ "\n";
|
||||
|
||||
boolean getLodOnlyMode();
|
||||
void setLodOnlyMode(boolean newLodOnlyMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,7 +167,11 @@
|
||||
"DistantHorizons.config.client.graphics.advancedGraphics.enableCaveCulling":
|
||||
"Cave Culling §6(EXPERIMENTAL)§r",
|
||||
"DistantHorizons.config.client.graphics.advancedGraphics.enableCaveCulling.@tooltip":
|
||||
"If enabled caves will be culled \n\n§6NOTE: This feature is under development and \n it is VERY experimental! Please don't report \nany issues related to this feature.§r \n\nAdditional Info: Currently this cull all faces \n with skylight value of 0 in dimensions that \n does not have a ceiling. \n",
|
||||
"If enabled caves will be culled \n\n§6NOTE§r: This feature is under development and \n it is VERY experimental! Please don't report \nany issues related to this feature. \n\nAdditional Info: Currently this cull all faces \n with skylight value of 0 in dimensions that \n does not have a ceiling. \n",
|
||||
"DistantHorizons.config.client.graphics.advancedGraphics.caveCullingHeight":
|
||||
"Cave Culling Height §6(EXPERIMENTAL)§r",
|
||||
"DistantHorizons.config.client.graphics.advancedGraphics.caveCullingHeight.@tooltip":
|
||||
"At what Y value should cave culling start? \n\n§6NOTE§r: This feature is under development and \n it is VERY experimental! Please don't report \nany issues related to this feature.",
|
||||
"DistantHorizons.config.client.worldGenerator":
|
||||
"World generator",
|
||||
"DistantHorizons.config.client.worldGenerator.generationPriority":
|
||||
@@ -244,6 +248,10 @@
|
||||
"Enable debug keybindings",
|
||||
"DistantHorizons.config.client.advanced.debugging.enableDebugKeybindings.@tooltip":
|
||||
"§6True:§r debug keybindings can be used to change the Debug mode in game.",
|
||||
"DistantHorizons.config.client.advanced.lodOnlyMode":
|
||||
"Lod Only Mode §6(ONLY FOR FUN)§r",
|
||||
"DistantHorizons.config.client.advanced.lodOnlyMode.@tooltip":
|
||||
"Due to some demand for playing without vanilla terrains, \nwe decided to add this mode for fun. \n\n§6NOTE§r: Do not report any issues when this mode is on! \n Again, this setting is only for fun, and mod \n compatibility is not guaranteed. \n",
|
||||
"DistantHorizons.config.enum.HorizontalResolution.BLOCK":
|
||||
"Block",
|
||||
"DistantHorizons.config.enum.HorizontalResolution.TWO_BLOCKS":
|
||||
|
||||
Reference in New Issue
Block a user