mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
fix block solidity property
This commit is contained in:
parent
325f0b1f02
commit
5fdff1f8f6
3 changed files with 18 additions and 8 deletions
|
|
@ -28,13 +28,17 @@ std::unique_ptr<Content> ContentBuilder::build() {
|
||||||
// Generating runtime info
|
// Generating runtime info
|
||||||
def.rt.id = blockDefsIndices.size();
|
def.rt.id = blockDefsIndices.size();
|
||||||
def.rt.emissive = *reinterpret_cast<uint32_t*>(def.emission);
|
def.rt.emissive = *reinterpret_cast<uint32_t*>(def.emission);
|
||||||
def.rt.solid = def.defaults.model.type == BlockModelType::BLOCK; // FIXME
|
|
||||||
def.rt.extended = def.size.x > 1 || def.size.y > 1 || def.size.z > 1;
|
|
||||||
|
|
||||||
const float EPSILON = 0.01f;
|
// TODO: refactor
|
||||||
if (def.rt.extended && glm::i8vec3(def.hitboxes[0].size() + EPSILON) == def.size) {
|
def.defaults.rt.solid = def.defaults.model.type == BlockModelType::BLOCK;
|
||||||
def.rt.solid = true;
|
if (def.variants) {
|
||||||
|
for (auto& variant : def.variants->variants) {
|
||||||
|
variant.rt.solid = variant.model.type == BlockModelType::BLOCK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
const float EPSILON = 0.01f;
|
||||||
|
def.rt.solid = glm::i8vec3(def.hitboxes[0].size() + EPSILON) == def.size;
|
||||||
|
def.rt.extended = def.size.x > 1 || def.size.y > 1 || def.size.z > 1;
|
||||||
|
|
||||||
if (def.rotatable) {
|
if (def.rotatable) {
|
||||||
for (uint i = 0; i < BlockRotProfile::MAX_COUNT; i++) {
|
for (uint i = 0; i < BlockRotProfile::MAX_COUNT; i++) {
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,9 @@ class BlocksRenderer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto& block = *blockDefsCache[vox.id];
|
const auto& block = *blockDefsCache[vox.id];
|
||||||
uint8_t otherDrawGroup = block.getVariant(vox.state.userbits).drawGroup;
|
const auto& blockVariant = block.getVariant(vox.state.userbits);
|
||||||
if ((otherDrawGroup && (otherDrawGroup != variant.drawGroup)) || !block.rt.solid) {
|
uint8_t otherDrawGroup = blockVariant.drawGroup;
|
||||||
|
if ((otherDrawGroup && (otherDrawGroup != variant.drawGroup)) || !blockVariant.rt.solid) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ((variant.culling == CullingMode::DISABLED ||
|
if ((variant.culling == CullingMode::DISABLED ||
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,11 @@ struct Variant {
|
||||||
CullingMode culling = CullingMode::DEFAULT;
|
CullingMode culling = CullingMode::DEFAULT;
|
||||||
/// @brief Influences visible block sides for transparent blocks
|
/// @brief Influences visible block sides for transparent blocks
|
||||||
uint8_t drawGroup = 0;
|
uint8_t drawGroup = 0;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
/// @brief is the block completely opaque for render
|
||||||
|
bool solid = true;
|
||||||
|
} rt;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Variants {
|
struct Variants {
|
||||||
|
|
@ -258,7 +263,7 @@ public:
|
||||||
/// @brief block runtime integer id
|
/// @brief block runtime integer id
|
||||||
blockid_t id;
|
blockid_t id;
|
||||||
|
|
||||||
/// @brief is the block completely opaque for render and raycast
|
/// @brief is the block completely opaque for raycast
|
||||||
bool solid = true;
|
bool solid = true;
|
||||||
|
|
||||||
/// @brief does the block emit any lights
|
/// @brief does the block emit any lights
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue