mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
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.MatrixM4f;
|
||||
import de.bluecolored.bluemap.core.util.math.VectorM2f;
|
||||
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.block.ExtendedBlock;
|
||||
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.
|
||||
@ -179,14 +179,6 @@ private void createElementFace(Element element, Direction faceDir, VectorM3f c0,
|
||||
|
||||
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
|
||||
ExtendedBlock<?> facedBlockNeighbor = getRotationRelativeBlock(faceDir);
|
||||
LightData blockLightData = block.getLightData();
|
||||
@ -201,6 +193,14 @@ private void createElementFace(Element element, Direction faceDir, VectorM3f c0,
|
||||
(renderSettings.isCaveDetectionUsesBlockLight() ? Math.max(blockLight, sunLight) : sunLight) == 0
|
||||
) 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
|
||||
blockModel.initialize();
|
||||
blockModel.add(2);
|
||||
|
Loading…
Reference in New Issue
Block a user