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