made config for minimum back side culling distance. actual value is using prev player pos so on long flights it works better.
This commit is contained in:
@@ -28,6 +28,8 @@ import com.seibel.lod.core.objects.opengl.LodBufferBuilder;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.DataPointUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.util.SingletonHandler;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
|
||||
import static com.seibel.lod.core.builders.lodBuilding.LodBuilder.MIN_WORLD_HEIGHT;
|
||||
|
||||
@@ -40,11 +42,9 @@ import static com.seibel.lod.core.builders.lodBuilding.LodBuilder.MIN_WORLD_HEIG
|
||||
*/
|
||||
public class CubicLodTemplate
|
||||
{
|
||||
//TODO make it a config
|
||||
static int cullingRange = 128;
|
||||
|
||||
public static void addLodToBuffer(LodBufferBuilder buffer, int playerX, int playerZ, long data, Map<LodDirection, long[]> adjData,
|
||||
byte detailLevel, int posX, int posZ, VertexOptimizer vertexOptimizer, DebugMode debugging, boolean[] adjShadeDisabled)
|
||||
byte detailLevel, int posX, int posZ, VertexOptimizer vertexOptimizer, DebugMode debugging, boolean[] adjShadeDisabled, int cullingRangeX, int cullingRangeZ)
|
||||
{
|
||||
if (vertexOptimizer == null)
|
||||
return;
|
||||
@@ -73,7 +73,7 @@ public class CubicLodTemplate
|
||||
DataPointUtil.getLightBlock(data),
|
||||
adjShadeDisabled);
|
||||
|
||||
addBoundingBoxToBuffer(buffer, vertexOptimizer);
|
||||
addBoundingBoxToBuffer(buffer, vertexOptimizer, cullingRangeX, cullingRangeZ);
|
||||
}
|
||||
|
||||
/** add the given position and color to the buffer */
|
||||
@@ -120,7 +120,7 @@ public class CubicLodTemplate
|
||||
vertexOptimizer.setAdjData(adjData);
|
||||
}
|
||||
|
||||
private static void addBoundingBoxToBuffer(LodBufferBuilder buffer, VertexOptimizer vertexOptimizer)
|
||||
private static void addBoundingBoxToBuffer(LodBufferBuilder buffer, VertexOptimizer vertexOptimizer, int cullingRangeX, int cullingRangeZ)
|
||||
{
|
||||
int color;
|
||||
byte skyLight;
|
||||
@@ -131,10 +131,11 @@ public class CubicLodTemplate
|
||||
//if(vertexOptimizer.isCulled(lodDirection))
|
||||
// continue;
|
||||
// culling
|
||||
if (lodDirection == LodDirection.NORTH && vertexOptimizer.getZ(lodDirection, 0) < -cullingRange
|
||||
|| lodDirection == LodDirection.EAST && vertexOptimizer.getX(lodDirection, 0) > cullingRange
|
||||
|| lodDirection == LodDirection.SOUTH && vertexOptimizer.getZ(lodDirection, 0) > cullingRange
|
||||
|| lodDirection == LodDirection.WEST && vertexOptimizer.getX(lodDirection, 0) < -cullingRange)
|
||||
|
||||
if (lodDirection == LodDirection.NORTH && vertexOptimizer.getZ(lodDirection, 0) < -cullingRangeZ
|
||||
|| lodDirection == LodDirection.EAST && vertexOptimizer.getX(lodDirection, 0) > cullingRangeX
|
||||
|| lodDirection == LodDirection.SOUTH && vertexOptimizer.getZ(lodDirection, 0) > cullingRangeZ
|
||||
|| lodDirection == LodDirection.WEST && vertexOptimizer.getX(lodDirection, 0) < -cullingRangeX)
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
+11
-3
@@ -165,6 +165,10 @@ public class LodBufferBuilderFactory
|
||||
private volatile int buildableCenterBlockPosX = 0;
|
||||
private volatile int buildableCenterBlockPosZ = 0;
|
||||
|
||||
private volatile int minCullingRange = SingletonHandler.get(ILodConfigWrapperSingleton.class).client().graphics().advancedGraphics().getBacksideCullingRange();
|
||||
private volatile int lastX = 0;
|
||||
private volatile int lastZ = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -256,6 +260,9 @@ public class LodBufferBuilderFactory
|
||||
|
||||
skyLightPlayer = MC.getWrappedClientWorld().getSkyLight(playerX, playerY, playerZ);
|
||||
|
||||
int cullingRangeX = Math.max((int)(1.5 * Math.abs(lastX - playerX)), minCullingRange);
|
||||
int cullingRangeZ = Math.max((int)(1.5 * Math.abs(lastZ - playerZ)), minCullingRange);
|
||||
|
||||
for (int xRegion = 0; xRegion < lodDim.getWidth(); xRegion++)
|
||||
{
|
||||
for (int zRegion = 0; zRegion < lodDim.getWidth(); zRegion++)
|
||||
@@ -332,8 +339,6 @@ public class LodBufferBuilderFactory
|
||||
boolean[][] vanillaRenderedChunks = renderer.vanillaRenderedChunks;
|
||||
short gameChunkRenderDistance = (short) (vanillaRenderedChunks.length / 2 - 1);
|
||||
|
||||
|
||||
|
||||
for (int index = 0; index < posToRender.getNumberOfPos(); index++)
|
||||
{
|
||||
bufferIndex = index % currentBuffers.length;
|
||||
@@ -434,7 +439,7 @@ public class LodBufferBuilderFactory
|
||||
|
||||
//We send the call to create the vertices
|
||||
CubicLodTemplate.addLodToBuffer(currentBuffers[bufferIndex], playerX, playerZ, data, adjData,
|
||||
detailLevel, posX, posZ, vertexOptimizer, renderer.previousDebugMode, adjShadeDisabled);
|
||||
detailLevel, posX, posZ, vertexOptimizer, renderer.previousDebugMode, adjShadeDisabled, cullingRangeX, cullingRangeZ);
|
||||
}
|
||||
|
||||
} // for pos to in list to render
|
||||
@@ -448,6 +453,9 @@ public class LodBufferBuilderFactory
|
||||
} // region z
|
||||
} // region z
|
||||
|
||||
lastX = playerX;
|
||||
lastZ = playerZ;
|
||||
|
||||
|
||||
//long executeStart = System.currentTimeMillis();
|
||||
// wait for all threads to finish
|
||||
|
||||
@@ -80,7 +80,6 @@ public class LodBuilder
|
||||
|
||||
//public static final boolean useExperimentalLighting = true;
|
||||
|
||||
private static int timesToEdgeDetect = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
+8
@@ -224,6 +224,14 @@ public interface ILodConfigWrapperSingleton
|
||||
VanillaOverdraw getVanillaOverdraw();
|
||||
void setVanillaOverdraw(VanillaOverdraw newVanillaOverdraw);
|
||||
|
||||
MinDefaultMax<Integer> VANILLA_CULLING_RANGE_MIN_DEFAULT_MAX = new MinDefaultMax<Integer>(0, 32, 512);
|
||||
String HORIZONTAL_SCALE_DESC = ""
|
||||
+ " This indicates the minimum range where back sides of blocks start get get culled. \n"
|
||||
+ " Higher settings will make terrain look good when looking backwards \n"
|
||||
+ " when changing speeds quickly, but will increase upload times and GPU usage.";
|
||||
int getBacksideCullingRange();
|
||||
void setBacksideCullingRange(int backsideCullingRange);
|
||||
|
||||
boolean USE_EXTENDED_NEAR_CLIP_PLANE_DEFAULT = false;
|
||||
String USE_EXTENDED_NEAR_CLIP_PLANE_DESC = ""
|
||||
+ " Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n"
|
||||
|
||||
Reference in New Issue
Block a user