mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
minor optimizations + MAX_WORK_PER_FRAME increased
This commit is contained in:
parent
7957a12b84
commit
064b4516f2
2 changed files with 46 additions and 44 deletions
|
|
@ -19,15 +19,15 @@
|
|||
#include <memory>
|
||||
#include <iostream>
|
||||
|
||||
const uint MAX_WORK_PER_FRAME = 64;
|
||||
const uint MAX_WORK_PER_FRAME = 128;
|
||||
const uint MIN_SURROUNDING = 9;
|
||||
|
||||
ChunksController::ChunksController(Level* level, uint padding)
|
||||
: level(level),
|
||||
chunks(level->chunks.get()),
|
||||
lighting(level->lighting.get()),
|
||||
padding(padding),
|
||||
generator(WorldGenerators::createGenerator(level->getWorld()->getGenerator(), level->content)) {
|
||||
: level(level),
|
||||
chunks(level->chunks.get()),
|
||||
lighting(level->lighting.get()),
|
||||
padding(padding),
|
||||
generator(WorldGenerators::createGenerator(level->getWorld()->getGenerator(), level->content)) {
|
||||
}
|
||||
|
||||
ChunksController::~ChunksController(){
|
||||
|
|
@ -59,7 +59,7 @@ bool ChunksController::loadVisible(){
|
|||
for (uint z = padding; z < d-padding; z++){
|
||||
for (uint x = padding; x < w-padding; x++){
|
||||
int index = z * w + x;
|
||||
auto chunk = chunks->chunks[index];
|
||||
auto& chunk = chunks->chunks[index];
|
||||
if (chunk != nullptr){
|
||||
if (chunk->isLoaded() && !chunk->isLighted()) {
|
||||
if (buildLights(chunk)) {
|
||||
|
|
@ -79,7 +79,7 @@ bool ChunksController::loadVisible(){
|
|||
}
|
||||
}
|
||||
|
||||
auto chunk = chunks->chunks[nearZ * w + nearX];
|
||||
const auto& chunk = chunks->chunks[nearZ * w + nearX];
|
||||
if (chunk != nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue