mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 05:51:51 +00:00
test clouds
This commit is contained in:
parent
cf69d3e8f4
commit
e24a5db97a
7 changed files with 409 additions and 69 deletions
|
|
@ -6,15 +6,17 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
class Content;
|
||||
|
||||
class VoxelsVolume {
|
||||
public:
|
||||
static inline constexpr size_t MAX_VOXELS = CHUNK_VOL * 2;
|
||||
|
||||
VoxelsVolume(int w, int h, int d)
|
||||
: VoxelsVolume(0, 0, 0, w, h, d) {}
|
||||
|
||||
VoxelsVolume(int x, int y, int z, int w, int h, int d)
|
||||
: x(x), y(y), z(z), w(w), h(h), d(d) {
|
||||
: x(x), y(y), z(z), w(w), h(h), d(d),
|
||||
voxels(std::make_unique<voxel[]>(w * h * d)),
|
||||
lights(std::make_unique<light_t[]>(w * h * d)) {
|
||||
std::memset(voxels.get(), 0xFF, sizeof(voxel) * w * h * d);
|
||||
}
|
||||
|
||||
|
|
@ -52,10 +54,18 @@ public:
|
|||
return voxels.get();
|
||||
}
|
||||
|
||||
const voxel* getVoxels() const {
|
||||
return voxels.get();
|
||||
}
|
||||
|
||||
light_t* getLights() {
|
||||
return lights.get();
|
||||
}
|
||||
|
||||
const light_t* getLights() const {
|
||||
return lights.get();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
|
@ -80,6 +90,8 @@ public:
|
|||
}
|
||||
return lights[vox_index(bx - x, by - y, bz - z, w, d)];
|
||||
}
|
||||
|
||||
void compressInto(VoxelsVolume& dst, const Content& content) const;
|
||||
private:
|
||||
int x, y, z;
|
||||
int w, h, d;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue