mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
main menu glitch fix + refactor
This commit is contained in:
parent
997cff04d1
commit
ffdeac5c1f
4 changed files with 72 additions and 76 deletions
|
|
@ -1,30 +1,23 @@
|
|||
#include "VoxelsVolume.hpp"
|
||||
|
||||
VoxelsVolume::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) {
|
||||
voxels = new voxel[w * h * d];
|
||||
for (int i = 0; i < w * h * d; i++) {
|
||||
voxels[i].id = BLOCK_VOID;
|
||||
}
|
||||
lights = new light_t[w * h * d];
|
||||
VoxelsVolume::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),
|
||||
voxels(std::make_unique<voxel[]>(w * h * d)),
|
||||
lights(std::make_unique<light_t[]>(w * h * d))
|
||||
{
|
||||
for (int i = 0; i < w * h * d; i++) {
|
||||
voxels[i].id = BLOCK_VOID;
|
||||
}
|
||||
}
|
||||
|
||||
VoxelsVolume::VoxelsVolume(int w, int h, int d)
|
||||
: x(0), y(0), z(0), w(w), h(h), d(d) {
|
||||
voxels = new voxel[w * h * d];
|
||||
for (int i = 0; i < w * h * d; i++) {
|
||||
voxels[i].id = BLOCK_VOID;
|
||||
}
|
||||
lights = new light_t[w * h * d];
|
||||
}
|
||||
VoxelsVolume::VoxelsVolume(int w, int h, int d) : VoxelsVolume(0, 0, 0, w, h, d)
|
||||
{}
|
||||
|
||||
VoxelsVolume::~VoxelsVolume() {
|
||||
delete[] lights;
|
||||
delete[] voxels;
|
||||
}
|
||||
VoxelsVolume::~VoxelsVolume() {}
|
||||
|
||||
void VoxelsVolume::setPosition(int x, int y, int z) {
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue