mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 13:01:49 +00:00
fixes
This commit is contained in:
parent
32a26ebbcc
commit
c323b1ad15
4 changed files with 23 additions and 17 deletions
|
|
@ -123,7 +123,7 @@ VC_ENUM_METADATA(BlockModelType)
|
|||
{"custom", BlockModelType::CUSTOM},
|
||||
VC_ENUM_END
|
||||
|
||||
enum class CullingMode {
|
||||
enum class CullingMode : uint8_t {
|
||||
DEFAULT,
|
||||
OPTIONAL,
|
||||
DISABLED,
|
||||
|
|
|
|||
|
|
@ -130,29 +130,36 @@ public:
|
|||
return lights;
|
||||
}
|
||||
|
||||
inline blockid_t pickBlockId(int bx, int by, int bz) const {
|
||||
if (bx < x || by < y || bz < z || bx >= x + w || by >= y + h ||
|
||||
bz >= z + d) {
|
||||
inline blockid_t pickBlockId(uint bx, uint by, uint bz) const {
|
||||
bx -= x;
|
||||
by -= y;
|
||||
bz -= z;
|
||||
if (bx >= w || by >= h || bz >= d) {
|
||||
return BLOCK_VOID;
|
||||
}
|
||||
return voxels[vox_index(bx - x, by - y, bz - z, w, d)].id;
|
||||
return voxels[vox_index(bx, by, bz, w, d)].id;
|
||||
}
|
||||
|
||||
|
||||
inline voxel pickBlock(int bx, int by, int bz) const {
|
||||
if (bx < x || by < y || bz < z || bx >= x + w || by >= y + h ||
|
||||
bz >= z + d) {
|
||||
return {BLOCK_VOID, {}};
|
||||
inline const voxel& pickBlock(uint bx, uint by, uint bz) const {
|
||||
bx -= x;
|
||||
by -= y;
|
||||
bz -= z;
|
||||
if (bx >= w || by >= h || bz >= d) {
|
||||
static voxel voidVoxel {BLOCK_VOID, {}};
|
||||
return voidVoxel;
|
||||
}
|
||||
return voxels[vox_index(bx - x, by - y, bz - z, w, d)];
|
||||
return voxels[vox_index(bx, by, bz, w, d)];
|
||||
}
|
||||
|
||||
inline light_t pickLight(int bx, int by, int bz) const {
|
||||
if (bx < x || by < y || bz < z || bx >= x + w || by >= y + h ||
|
||||
bz >= z + d) {
|
||||
inline light_t pickLight(uint bx, uint by, uint bz) const {
|
||||
bx -= x;
|
||||
by -= y;
|
||||
bz -= z;
|
||||
if (bx >= w || by >= h || bz >= d) {
|
||||
return 0;
|
||||
}
|
||||
return lights[vox_index(bx - x, by - y, bz - z, w, d)];
|
||||
return lights[vox_index(bx, by, bz, w, d)];
|
||||
}
|
||||
private:
|
||||
int x, y, z;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue