Small chunks render fix
This commit is contained in:
parent
f569378b88
commit
37dd882fdb
@ -149,6 +149,8 @@ bool ChunksController::_buildMeshes(VoxelRenderer* renderer, int tick) {
|
|||||||
if (chunk->renderData.vertices > (void*)1){
|
if (chunk->renderData.vertices > (void*)1){
|
||||||
const int chunk_attrs[] = {3,2,4, 0};
|
const int chunk_attrs[] = {3,2,4, 0};
|
||||||
Mesh* mesh = new Mesh(chunk->renderData.vertices, chunk->renderData.size / CHUNK_VERTEX_SIZE, chunk_attrs);
|
Mesh* mesh = new Mesh(chunk->renderData.vertices, chunk->renderData.size / CHUNK_VERTEX_SIZE, chunk_attrs);
|
||||||
|
if (chunks->meshes[index])
|
||||||
|
delete chunks->meshes[index];
|
||||||
chunks->meshes[index] = mesh;
|
chunks->meshes[index] = mesh;
|
||||||
delete[] chunk->renderData.vertices;
|
delete[] chunk->renderData.vertices;
|
||||||
chunk->renderData.vertices = nullptr;
|
chunk->renderData.vertices = nullptr;
|
||||||
@ -209,8 +211,6 @@ bool ChunksController::_buildMeshes(VoxelRenderer* renderer, int tick) {
|
|||||||
Mesh* mesh = chunks->meshes[index];
|
Mesh* mesh = chunks->meshes[index];
|
||||||
if (mesh == nullptr || chunk->modified){
|
if (mesh == nullptr || chunk->modified){
|
||||||
Chunk* closes[27];
|
Chunk* closes[27];
|
||||||
if (mesh != nullptr)
|
|
||||||
delete mesh;
|
|
||||||
if (chunk->isEmpty()){
|
if (chunk->isEmpty()){
|
||||||
chunks->meshes[index] = nullptr;
|
chunks->meshes[index] = nullptr;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user