Finish adding simple frustum culling
This commit is contained in:
@@ -319,21 +319,18 @@ public class LodRenderer
|
||||
|
||||
if (vbos != null)
|
||||
{
|
||||
int rendered = 0;
|
||||
int skipped = 0;
|
||||
|
||||
Vector3d cameraDir = mc.cameraEntity.getLookAngle();
|
||||
Vector3d cameraDir = mc.cameraEntity.getLookAngle().normalize();
|
||||
|
||||
// used to determine what type of fog to render
|
||||
int halfWidth = vbos.length/2;
|
||||
int quarterWidth = vbos.length/4;
|
||||
|
||||
for (int i = 0; i < vbos.length; i++)
|
||||
for (int i = 0; i < vbos.length; i++)
|
||||
{
|
||||
for (int j = 0; j < vbos.length; j++)
|
||||
{
|
||||
RegionPos vboPos = new RegionPos(i + lodDim.getCenterX() - lodDim.getWidth()/2, j + lodDim.getCenterZ() - lodDim.getWidth()/2);
|
||||
if (RenderUtil.isRegionInViewFrustum(player.blockPosition(), cameraDir, vboPos.blockPos()))
|
||||
if (RenderUtil.isRegionInViewFrustum(mc.cameraEntity.blockPosition(), cameraDir, vboPos.blockPos()))
|
||||
{
|
||||
if ((i > halfWidth - quarterWidth && i < halfWidth + quarterWidth) && (j > halfWidth - quarterWidth && j < halfWidth + quarterWidth))
|
||||
setupFog(fogSettings.near.distance, fogSettings.near.quality);
|
||||
@@ -342,16 +339,9 @@ public class LodRenderer
|
||||
|
||||
|
||||
sendLodsToGpuAndDraw(vbos[i][j], modelViewMatrix);
|
||||
rendered++;
|
||||
}
|
||||
else
|
||||
{
|
||||
skipped++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClientProxy.LOGGER.info(rendered + " - " + skipped);
|
||||
}
|
||||
|
||||
|
||||
@@ -389,7 +379,6 @@ public class LodRenderer
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This is where the actual drawing happens.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user