mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-03-12 06:42:26 +01:00
Make ice/glass blocks culling themselves if blocks are identical
This commit is contained in:
parent
66ce77ccc9
commit
f4e2767410
@ -46,6 +46,7 @@
|
||||
import de.bluecolored.bluemap.core.util.math.VectorM2f;
|
||||
import de.bluecolored.bluemap.core.util.math.VectorM3f;
|
||||
import de.bluecolored.bluemap.core.world.BlockNeighborhood;
|
||||
import de.bluecolored.bluemap.core.world.BlockProperties;
|
||||
import de.bluecolored.bluemap.core.world.ExtendedBlock;
|
||||
import de.bluecolored.bluemap.core.world.LightData;
|
||||
|
||||
@ -186,7 +187,9 @@ private void createElementFace(Element element, Direction faceDir, VectorM3f c0,
|
||||
// face culling
|
||||
if (face.getCullface() != null) {
|
||||
ExtendedBlock<?> b = getRotationRelativeBlock(face.getCullface());
|
||||
if (b.getProperties().isCulling()) return;
|
||||
BlockProperties p = b.getProperties();
|
||||
if (p.isCulling()) return;
|
||||
if (p.getCullingIdentical() && b.getBlockState().equals(block.getBlockState())) return;
|
||||
}
|
||||
|
||||
// light calculation
|
||||
|
@ -66,6 +66,7 @@ public void load(Path configFile) throws IOException {
|
||||
case "occluding": bsValueBuilder.occluding(json.nextBoolean()); break;
|
||||
case "alwaysWaterlogged": bsValueBuilder.alwaysWaterlogged(json.nextBoolean()); break;
|
||||
case "randomOffset": bsValueBuilder.randomOffset(json.nextBoolean()); break;
|
||||
case "cullingIdentical": bsValueBuilder.cullingIdentical(json.nextBoolean()); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
@ -32,25 +32,28 @@ public class BlockProperties {
|
||||
|
||||
public static final BlockProperties DEFAULT = new BlockProperties();
|
||||
|
||||
private Tristate culling, occluding, alwaysWaterlogged, randomOffset;
|
||||
private Tristate culling, occluding, alwaysWaterlogged, randomOffset, cullingIdentical;
|
||||
|
||||
public BlockProperties() {
|
||||
this.culling = Tristate.UNDEFINED;
|
||||
this.occluding = Tristate.UNDEFINED;
|
||||
this.alwaysWaterlogged = Tristate.UNDEFINED;
|
||||
this.randomOffset = Tristate.UNDEFINED;
|
||||
this.cullingIdentical = Tristate.UNDEFINED;
|
||||
}
|
||||
|
||||
public BlockProperties(
|
||||
Tristate culling,
|
||||
Tristate occluding,
|
||||
Tristate alwaysWaterlogged,
|
||||
Tristate randomOffset
|
||||
Tristate randomOffset,
|
||||
Tristate cullingIdentical
|
||||
) {
|
||||
this.culling = culling;
|
||||
this.occluding = occluding;
|
||||
this.alwaysWaterlogged = alwaysWaterlogged;
|
||||
this.randomOffset = randomOffset;
|
||||
this.cullingIdentical = cullingIdentical;
|
||||
}
|
||||
|
||||
public boolean isCulling() {
|
||||
@ -69,12 +72,17 @@ public boolean isRandomOffset() {
|
||||
return randomOffset.getOr(false);
|
||||
}
|
||||
|
||||
public boolean getCullingIdentical() {
|
||||
return cullingIdentical.getOr(false);
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new BlockProperties(
|
||||
culling,
|
||||
occluding,
|
||||
alwaysWaterlogged,
|
||||
randomOffset
|
||||
randomOffset,
|
||||
cullingIdentical
|
||||
).new Builder();
|
||||
}
|
||||
|
||||
@ -104,11 +112,17 @@ public Builder randomOffset(boolean randomOffset) {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder cullingIdentical(boolean cullingIdentical) {
|
||||
BlockProperties.this.cullingIdentical = cullingIdentical ? Tristate.TRUE : Tristate.FALSE;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder from(BlockProperties other) {
|
||||
culling = other.culling.getOr(culling);
|
||||
occluding = other.occluding.getOr(occluding);
|
||||
alwaysWaterlogged = other.alwaysWaterlogged.getOr(alwaysWaterlogged);
|
||||
randomOffset = other.randomOffset.getOr(randomOffset);
|
||||
cullingIdentical = other.cullingIdentical.getOr(cullingIdentical);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -132,6 +146,10 @@ public Tristate isRandomOffset() {
|
||||
return randomOffset;
|
||||
}
|
||||
|
||||
public Tristate isCullingIdentical() {
|
||||
return cullingIdentical;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -141,6 +159,7 @@ public String toString() {
|
||||
", occluding=" + occluding +
|
||||
", alwaysWaterlogged=" + alwaysWaterlogged +
|
||||
", randomOffset=" + randomOffset +
|
||||
", cullingIdentical=" + cullingIdentical +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
@ -31,22 +31,24 @@
|
||||
"minecraft:hanging_roots": { "randomOffset": true },
|
||||
"minecraft:small_dripleaf": { "randomOffset": true },
|
||||
|
||||
"minecraft:glass": { "occluding": false },
|
||||
"minecraft:tinted_glass": { "occluding": false },
|
||||
"minecraft:white_stained_glass": { "occluding": false },
|
||||
"minecraft:orange_stained_glass": { "occluding": false },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false },
|
||||
"minecraft:lime_stained_glass": { "occluding": false },
|
||||
"minecraft:pink_stained_glass": { "occluding": false },
|
||||
"minecraft:gray_stained_glass": { "occluding": false },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false },
|
||||
"minecraft:purple_stained_glass": { "occluding": false },
|
||||
"minecraft:blue_stained_glass": { "occluding": false },
|
||||
"minecraft:brown_stained_glass": { "occluding": false },
|
||||
"minecraft:green_stained_glass": { "occluding": false },
|
||||
"minecraft:red_stained_glass": { "occluding": false },
|
||||
"minecraft:black_stained_glass": { "occluding": false }
|
||||
"minecraft:glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:tinted_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:white_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:orange_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:lime_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:pink_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:purple_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:brown_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:green_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:red_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:black_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
|
||||
"minecraft:ice": { "cullingIdentical": true }
|
||||
}
|
@ -31,22 +31,24 @@
|
||||
"minecraft:hanging_roots": { "randomOffset": true },
|
||||
"minecraft:small_dripleaf": { "randomOffset": true },
|
||||
|
||||
"minecraft:glass": { "occluding": false },
|
||||
"minecraft:tinted_glass": { "occluding": false },
|
||||
"minecraft:white_stained_glass": { "occluding": false },
|
||||
"minecraft:orange_stained_glass": { "occluding": false },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false },
|
||||
"minecraft:lime_stained_glass": { "occluding": false },
|
||||
"minecraft:pink_stained_glass": { "occluding": false },
|
||||
"minecraft:gray_stained_glass": { "occluding": false },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false },
|
||||
"minecraft:purple_stained_glass": { "occluding": false },
|
||||
"minecraft:blue_stained_glass": { "occluding": false },
|
||||
"minecraft:brown_stained_glass": { "occluding": false },
|
||||
"minecraft:green_stained_glass": { "occluding": false },
|
||||
"minecraft:red_stained_glass": { "occluding": false },
|
||||
"minecraft:black_stained_glass": { "occluding": false }
|
||||
"minecraft:glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:tinted_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:white_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:orange_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:lime_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:pink_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:purple_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:brown_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:green_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:red_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:black_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
|
||||
"minecraft:ice": { "cullingIdentical": true }
|
||||
}
|
@ -31,22 +31,24 @@
|
||||
"minecraft:hanging_roots": { "randomOffset": true },
|
||||
"minecraft:small_dripleaf": { "randomOffset": true },
|
||||
|
||||
"minecraft:glass": { "occluding": false },
|
||||
"minecraft:tinted_glass": { "occluding": false },
|
||||
"minecraft:white_stained_glass": { "occluding": false },
|
||||
"minecraft:orange_stained_glass": { "occluding": false },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false },
|
||||
"minecraft:lime_stained_glass": { "occluding": false },
|
||||
"minecraft:pink_stained_glass": { "occluding": false },
|
||||
"minecraft:gray_stained_glass": { "occluding": false },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false },
|
||||
"minecraft:purple_stained_glass": { "occluding": false },
|
||||
"minecraft:blue_stained_glass": { "occluding": false },
|
||||
"minecraft:brown_stained_glass": { "occluding": false },
|
||||
"minecraft:green_stained_glass": { "occluding": false },
|
||||
"minecraft:red_stained_glass": { "occluding": false },
|
||||
"minecraft:black_stained_glass": { "occluding": false }
|
||||
"minecraft:glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:tinted_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:white_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:orange_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:lime_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:pink_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:purple_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:brown_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:green_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:red_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:black_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
|
||||
"minecraft:ice": { "cullingIdentical": true }
|
||||
}
|
@ -31,22 +31,24 @@
|
||||
"minecraft:hanging_roots": { "randomOffset": true },
|
||||
"minecraft:small_dripleaf": { "randomOffset": true },
|
||||
|
||||
"minecraft:glass": { "occluding": false },
|
||||
"minecraft:tinted_glass": { "occluding": false },
|
||||
"minecraft:white_stained_glass": { "occluding": false },
|
||||
"minecraft:orange_stained_glass": { "occluding": false },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false },
|
||||
"minecraft:lime_stained_glass": { "occluding": false },
|
||||
"minecraft:pink_stained_glass": { "occluding": false },
|
||||
"minecraft:gray_stained_glass": { "occluding": false },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false },
|
||||
"minecraft:purple_stained_glass": { "occluding": false },
|
||||
"minecraft:blue_stained_glass": { "occluding": false },
|
||||
"minecraft:brown_stained_glass": { "occluding": false },
|
||||
"minecraft:green_stained_glass": { "occluding": false },
|
||||
"minecraft:red_stained_glass": { "occluding": false },
|
||||
"minecraft:black_stained_glass": { "occluding": false }
|
||||
"minecraft:glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:tinted_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:white_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:orange_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:magenta_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:yellow_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:lime_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:pink_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:light_gray_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:cyan_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:purple_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:blue_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:brown_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:green_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:red_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
"minecraft:black_stained_glass": { "occluding": false, "cullingIdentical": true },
|
||||
|
||||
"minecraft:ice": { "cullingIdentical": true }
|
||||
}
|
Loading…
Reference in New Issue
Block a user