mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-08-03 11:17:05 -04:00
parent
2d73ebdc0a
commit
bb25c0181e
@ -6,7 +6,7 @@
|
||||
"0.1 cubyz:apple"
|
||||
],
|
||||
"degradable" : true,
|
||||
"viewThrough" : true,
|
||||
"alwaysViewThrough" : true,
|
||||
"absorbedLight" : 0x121012,
|
||||
"model" : "cube",
|
||||
"texture" : "cubyz:oak_leaves_transparent"
|
||||
|
@ -6,7 +6,7 @@
|
||||
"0.1 cubyz:apple"
|
||||
],
|
||||
"degradable" : true,
|
||||
"viewThrough" : true,
|
||||
"alwaysViewThrough" : true,
|
||||
"absorbedLight" : 0x121012,
|
||||
"model" : "cube",
|
||||
"texture" : "cubyz:pine_needles"
|
||||
|
@ -70,6 +70,7 @@ var _blockDrops: [maxBlockCount][]BlockDrop = undefined;
|
||||
/// Meaning undegradable parts of trees or other structures can grow through this block.
|
||||
var _degradable: [maxBlockCount]bool = undefined;
|
||||
var _viewThrough: [maxBlockCount]bool = undefined;
|
||||
var _alwaysViewThrough: [maxBlockCount]bool = undefined;
|
||||
var _hasBackFace: [maxBlockCount]bool = undefined;
|
||||
var _blockClass: [maxBlockCount]BlockClass = undefined;
|
||||
var _light: [maxBlockCount]u32 = undefined;
|
||||
@ -114,7 +115,8 @@ pub fn register(_: []const u8, id: []const u8, json: JsonElement) u16 {
|
||||
_solid[size] = json.get(bool, "solid", true);
|
||||
_gui[size] = allocator.dupe(u8, json.get([]const u8, "GUI", ""));
|
||||
_transparent[size] = json.get(bool, "transparent", false);
|
||||
_viewThrough[size] = json.get(bool, "viewThrough", false) or _transparent[size];
|
||||
_alwaysViewThrough[size] = json.get(bool, "alwaysViewThrough", false);
|
||||
_viewThrough[size] = json.get(bool, "viewThrough", false) or _transparent[size] or _alwaysViewThrough[size];
|
||||
_hasBackFace[size] = json.get(bool, "hasBackFace", false);
|
||||
|
||||
const oreProperties = json.getChild("ore");
|
||||
@ -256,6 +258,11 @@ pub const Block = packed struct {
|
||||
return _viewThrough[self.typ];
|
||||
}
|
||||
|
||||
/// shows backfaces even when next to the same block type
|
||||
pub inline fn alwaysViewThrough(self: Block) bool {
|
||||
return _alwaysViewThrough[self.typ];
|
||||
}
|
||||
|
||||
pub inline fn hasBackFace(self: Block) bool {
|
||||
return _hasBackFace[self.typ];
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ pub const ChunkMesh = struct {
|
||||
_ = model; // TODO: Check if the neighbor model occludes this one. (maybe not that relevant)
|
||||
return block.typ != 0 and (
|
||||
other.typ == 0
|
||||
or (!std.meta.eql(block, other) and other.viewThrough())
|
||||
or (!std.meta.eql(block, other) and other.viewThrough()) or other.alwaysViewThrough()
|
||||
or !models.models.items[blocks.meshes.model(other)].isNeighborOccluded[neighbor ^ 1]
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user