Close #30 and 31 (LODs rendering on top of the player and distance based rendering)

This commit is contained in:
James Seibel
2021-07-01 21:21:34 -05:00
parent 39c7ae8d17
commit 86d07eb62b
5 changed files with 96 additions and 36 deletions
@@ -129,9 +129,9 @@ public class LodBuilder
LodDetail detail = LodConfig.CLIENT.lodDetail.get();
LodDataPoint[][] dataPoints = new LodDataPoint[detail.lengthCount][detail.lengthCount];
LodDataPoint[][] dataPoints = new LodDataPoint[detail.dataPointLengthCount][detail.dataPointLengthCount];
for(int i = 0; i < detail.lengthCount * detail.lengthCount; i++)
for(int i = 0; i < detail.dataPointLengthCount * detail.dataPointLengthCount; i++)
{
int startX = detail.startX[i];
int startZ = detail.startZ[i];
@@ -157,8 +157,8 @@ public class LodBuilder
depth = 0;
}
int x = i / detail.lengthCount;
int z = i % detail.lengthCount;
int x = i / detail.dataPointLengthCount;
int z = i % detail.dataPointLengthCount;
dataPoints[x][z] = new LodDataPoint(height, depth, color);
}
@@ -38,9 +38,9 @@ public class CubicLodTemplate extends AbstractLodTemplate
// using the quality setting set by the config
LodDetail detail = LodConfig.CLIENT.lodDetail.get();
int halfWidth = detail.width / 2;
int halfWidth = detail.dataPointWidth / 2;
for(int i = 0; i < detail.lengthCount * detail.lengthCount; i++)
for(int i = 0; i < detail.dataPointLengthCount * detail.dataPointLengthCount; i++)
{
int startX = detail.startX[i];
int startZ = detail.startZ[i];
@@ -51,7 +51,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
bbox = generateBoundingBox(
centerLod.getAverageHeightOverArea(startX, startZ, endX, endZ),
centerLod.getAverageDepthOverArea(startX, startZ, endX, endZ),
detail.width,
detail.dataPointWidth,
xOffset - (halfWidth / 2) + detail.startX[i],
yOffset,
zOffset - (halfWidth / 2) + detail.startZ[i]);
@@ -165,7 +165,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
public int getBufferMemoryForSingleLod(LodDetail detail)
{
// (sidesOnACube * pointsInASquare * (positionPoints + colorPoints))) * howManyPointsPerLodChunk
return (6 * 4 * (3 + 4)) * detail.lengthCount * detail.lengthCount;
return (6 * 4 * (3 + 4)) * detail.dataPointLengthCount * detail.dataPointLengthCount;
}