mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-10 05:21:49 +00:00
fix
This commit is contained in:
parent
93979b2e53
commit
ff7e39ed27
1 changed files with 6 additions and 3 deletions
|
|
@ -19,15 +19,16 @@ LMPacker::LMPacker(const uint32_t sizes[], size_t length) {
|
||||||
}
|
}
|
||||||
|
|
||||||
LMPacker::~LMPacker() {
|
LMPacker::~LMPacker() {
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LMPacker::cleanup() {
|
||||||
if (matrix) {
|
if (matrix) {
|
||||||
for (unsigned int y = 0; y < (height >> mbit); y++) {
|
for (unsigned int y = 0; y < (height >> mbit); y++) {
|
||||||
delete[] matrix[y];
|
delete[] matrix[y];
|
||||||
}
|
}
|
||||||
delete[] matrix;
|
delete[] matrix;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void LMPacker::cleanup() {
|
|
||||||
placed.clear();
|
placed.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -41,6 +42,7 @@ bool LMPacker::build(uint32_t width, uint32_t height,
|
||||||
|
|
||||||
const unsigned int mwidth = width >> mbit;
|
const unsigned int mwidth = width >> mbit;
|
||||||
const unsigned int mheight = height >> mbit;
|
const unsigned int mheight = height >> mbit;
|
||||||
|
|
||||||
matrix = new rectangle**[mheight];
|
matrix = new rectangle**[mheight];
|
||||||
for (unsigned int y = 0; y < mheight; y++) {
|
for (unsigned int y = 0; y < mheight; y++) {
|
||||||
matrix[y] = new rectangle*[mwidth];
|
matrix[y] = new rectangle*[mwidth];
|
||||||
|
|
@ -48,6 +50,7 @@ bool LMPacker::build(uint32_t width, uint32_t height,
|
||||||
matrix[y][x] = nullptr;
|
matrix[y][x] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < rects.size(); i++) {
|
for (unsigned int i = 0; i < rects.size(); i++) {
|
||||||
rectangle& rect = rects[i];
|
rectangle& rect = rects[i];
|
||||||
rect = rectangle(rect.idx, 0, 0, rect.width, rect.height);
|
rect = rectangle(rect.idx, 0, 0, rect.width, rect.height);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue