mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
add variants (WIP)
This commit is contained in:
parent
01181b6403
commit
5478d121f0
16 changed files with 275 additions and 177 deletions
|
|
@ -113,8 +113,8 @@ class BlocksRenderer {
|
|||
);
|
||||
void blockCustomModel(
|
||||
const glm::ivec3& icoord,
|
||||
const Block* block,
|
||||
ubyte rotation,
|
||||
const Block& block,
|
||||
blockstate states,
|
||||
bool lights,
|
||||
bool ao
|
||||
);
|
||||
|
|
@ -122,24 +122,25 @@ class BlocksRenderer {
|
|||
bool isOpenForLight(int x, int y, int z) const;
|
||||
|
||||
// Does block allow to see other blocks sides (is it transparent)
|
||||
inline bool isOpen(const glm::ivec3& pos, const Block& def) const {
|
||||
auto id = voxelsBuffer->pickBlockId(
|
||||
inline bool isOpen(const glm::ivec3& pos, const Block& def, const Variant& variant) const {
|
||||
auto vox = voxelsBuffer->pickBlock(
|
||||
chunk->x * CHUNK_W + pos.x, pos.y, chunk->z * CHUNK_D + pos.z
|
||||
);
|
||||
if (id == BLOCK_VOID) {
|
||||
if (vox.id == BLOCK_VOID) {
|
||||
return false;
|
||||
}
|
||||
const auto& block = *blockDefsCache[id];
|
||||
if (((block.drawGroup != def.drawGroup) && block.drawGroup) || !block.rt.solid) {
|
||||
const auto& block = *blockDefsCache[vox.id];
|
||||
uint8_t otherDrawGroup = block.getVariant(vox.state.userbits).drawGroup;
|
||||
if ((otherDrawGroup && (otherDrawGroup != variant.drawGroup)) || !block.rt.solid) {
|
||||
return true;
|
||||
}
|
||||
if ((def.culling == CullingMode::DISABLED ||
|
||||
(def.culling == CullingMode::OPTIONAL &&
|
||||
if ((variant.culling == CullingMode::DISABLED ||
|
||||
(variant.culling == CullingMode::OPTIONAL &&
|
||||
settings.graphics.denseRender.get())) &&
|
||||
id == def.rt.id) {
|
||||
vox.id == def.rt.id) {
|
||||
return true;
|
||||
}
|
||||
return !id;
|
||||
return !vox.id;
|
||||
}
|
||||
|
||||
glm::vec4 pickLight(int x, int y, int z) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue