Do light/cave testing before face-culling to improve performance
This commit is contained in:
parent
81e8da3b70
commit
73a77e5e0e
|
@ -45,10 +45,10 @@ import de.bluecolored.bluemap.core.util.math.Color;
|
||||||
import de.bluecolored.bluemap.core.util.math.MatrixM4f;
|
import de.bluecolored.bluemap.core.util.math.MatrixM4f;
|
||||||
import de.bluecolored.bluemap.core.util.math.VectorM2f;
|
import de.bluecolored.bluemap.core.util.math.VectorM2f;
|
||||||
import de.bluecolored.bluemap.core.util.math.VectorM3f;
|
import de.bluecolored.bluemap.core.util.math.VectorM3f;
|
||||||
import de.bluecolored.bluemap.core.world.block.BlockNeighborhood;
|
|
||||||
import de.bluecolored.bluemap.core.world.BlockProperties;
|
import de.bluecolored.bluemap.core.world.BlockProperties;
|
||||||
import de.bluecolored.bluemap.core.world.block.ExtendedBlock;
|
|
||||||
import de.bluecolored.bluemap.core.world.LightData;
|
import de.bluecolored.bluemap.core.world.LightData;
|
||||||
|
import de.bluecolored.bluemap.core.world.block.BlockNeighborhood;
|
||||||
|
import de.bluecolored.bluemap.core.world.block.ExtendedBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This model builder creates a BlockStateModel using the information from parsed resource-pack json files.
|
* This model builder creates a BlockStateModel using the information from parsed resource-pack json files.
|
||||||
|
@ -179,14 +179,6 @@ public class ResourceModelBuilder {
|
||||||
|
|
||||||
Vector3i faceDirVector = faceDir.toVector();
|
Vector3i faceDirVector = faceDir.toVector();
|
||||||
|
|
||||||
// face culling
|
|
||||||
if (face.getCullface() != null) {
|
|
||||||
ExtendedBlock<?> b = getRotationRelativeBlock(face.getCullface());
|
|
||||||
BlockProperties p = b.getProperties();
|
|
||||||
if (p.isCulling()) return;
|
|
||||||
if (p.getCullingIdentical() && b.getBlockState().equals(block.getBlockState())) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// light calculation
|
// light calculation
|
||||||
ExtendedBlock<?> facedBlockNeighbor = getRotationRelativeBlock(faceDir);
|
ExtendedBlock<?> facedBlockNeighbor = getRotationRelativeBlock(faceDir);
|
||||||
LightData blockLightData = block.getLightData();
|
LightData blockLightData = block.getLightData();
|
||||||
|
@ -201,6 +193,14 @@ public class ResourceModelBuilder {
|
||||||
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0
|
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0
|
||||||
) return;
|
) return;
|
||||||
|
|
||||||
|
// face culling
|
||||||
|
if (face.getCullface() != null) {
|
||||||
|
ExtendedBlock<?> b = getRotationRelativeBlock(face.getCullface());
|
||||||
|
BlockProperties p = b.getProperties();
|
||||||
|
if (p.isCulling()) return;
|
||||||
|
if (p.getCullingIdentical() && b.getBlockState().equals(block.getBlockState())) return;
|
||||||
|
}
|
||||||
|
|
||||||
// initialize the faces
|
// initialize the faces
|
||||||
blockModel.initialize();
|
blockModel.initialize();
|
||||||
blockModel.add(2);
|
blockModel.add(2);
|
||||||
|
|
Loading…
Reference in New Issue