mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 14:01:49 +00:00
add explicit 'solid' block property
This commit is contained in:
parent
336ae09f66
commit
e451a4f3a3
5 changed files with 12 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ local names = {
|
||||||
"hidden", "draw-group", "picking-item", "surface-replacement", "script-name",
|
"hidden", "draw-group", "picking-item", "surface-replacement", "script-name",
|
||||||
"ui-layout", "inventory-size", "tick-interval", "overlay-texture",
|
"ui-layout", "inventory-size", "tick-interval", "overlay-texture",
|
||||||
"translucent", "fields", "particles", "icon-type", "icon", "placing-block",
|
"translucent", "fields", "particles", "icon-type", "icon", "placing-block",
|
||||||
"stack-size", "name", "script-file", "culling"
|
"stack-size", "name", "script-file", "culling", "solid"
|
||||||
}
|
}
|
||||||
for name, _ in pairs(user_props) do
|
for name, _ in pairs(user_props) do
|
||||||
table.insert(names, name)
|
table.insert(names, name)
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,15 @@ std::unique_ptr<Content> ContentBuilder::build() {
|
||||||
|
|
||||||
if (def.variants) {
|
if (def.variants) {
|
||||||
for (auto& variant : def.variants->variants) {
|
for (auto& variant : def.variants->variants) {
|
||||||
variant.rt.solid = variant.model.type == BlockModelType::BLOCK;
|
variant.rt.solid =
|
||||||
|
variant.model.type == BlockModelType::BLOCK ||
|
||||||
|
def.explictlySolid;
|
||||||
}
|
}
|
||||||
def.defaults = def.variants->variants.at(0);
|
def.defaults = def.variants->variants.at(0);
|
||||||
} else {
|
} else {
|
||||||
def.defaults.rt.solid = def.defaults.model.type == BlockModelType::BLOCK;
|
def.defaults.rt.solid =
|
||||||
|
def.defaults.model.type == BlockModelType::BLOCK ||
|
||||||
|
def.explictlySolid;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float EPSILON = 0.01f;
|
const float EPSILON = 0.01f;
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,7 @@ template<> void ContentUnitLoader<Block>::loadUnit(
|
||||||
root.at("tick-interval").get(def.tickInterval);
|
root.at("tick-interval").get(def.tickInterval);
|
||||||
root.at("overlay-texture").get(def.overlayTexture);
|
root.at("overlay-texture").get(def.overlayTexture);
|
||||||
root.at("translucent").get(def.translucent);
|
root.at("translucent").get(def.translucent);
|
||||||
|
root.at("solid").get(def.explictlySolid);
|
||||||
|
|
||||||
if (root.has("fields")) {
|
if (root.has("fields")) {
|
||||||
def.dataStruct = std::make_unique<StructLayout>();
|
def.dataStruct = std::make_unique<StructLayout>();
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ void BlocksRenderer::blockCustomModel(
|
||||||
|
|
||||||
if (!block.rt.extended
|
if (!block.rt.extended
|
||||||
&& !isOpen(glm::floor(coord + vp + 0.5f + n * 1e-3f), block, variant)
|
&& !isOpen(glm::floor(coord + vp + 0.5f + n * 1e-3f), block, variant)
|
||||||
&& is_aligned(n)) {
|
/*&& is_aligned(n)*/) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,9 @@ public:
|
||||||
/// @brief Block has semi-transparent texture
|
/// @brief Block has semi-transparent texture
|
||||||
bool translucent = false;
|
bool translucent = false;
|
||||||
|
|
||||||
|
/// @brief Explicitly overriding 'solid' property if true assigned
|
||||||
|
bool explictlySolid = false;
|
||||||
|
|
||||||
/// @brief Set of block physical hitboxes
|
/// @brief Set of block physical hitboxes
|
||||||
std::vector<AABB> hitboxes {AABB()};
|
std::vector<AABB> hitboxes {AABB()};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue