additional optimizations
This commit is contained in:
@@ -30,7 +30,6 @@ ChunksController::ChunksController(Level* level, uint padding)
|
||||
}
|
||||
|
||||
ChunksController::~ChunksController(){
|
||||
delete generator;
|
||||
}
|
||||
|
||||
void ChunksController::update(int64_t maxDuration) {
|
||||
@@ -73,6 +72,7 @@ bool ChunksController::loadVisible(){
|
||||
}
|
||||
chunk->surrounding = surrounding;
|
||||
if (surrounding == MIN_SURROUNDING && !chunk->isLighted()) {
|
||||
timeutil::ScopeLogTimer log(555);
|
||||
bool lightsCache = chunk->isLoadedLights();
|
||||
if (!lightsCache) {
|
||||
lighting->buildSkyLight(chunk->x, chunk->z);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef VOXELS_CHUNKSCONTROLLER_H_
|
||||
#define VOXELS_CHUNKSCONTROLLER_H_
|
||||
|
||||
#include <memory>
|
||||
#include "../typedefs.h"
|
||||
|
||||
class Level;
|
||||
@@ -11,22 +12,22 @@ class WorldGenerator;
|
||||
/* ChunksController manages chunks dynamic loading/unloading */
|
||||
class ChunksController {
|
||||
private:
|
||||
Level* level;
|
||||
Chunks* chunks;
|
||||
Lighting* lighting;
|
||||
uint padding;
|
||||
WorldGenerator* generator;
|
||||
Level* level;
|
||||
Chunks* chunks;
|
||||
Lighting* lighting;
|
||||
uint padding;
|
||||
std::unique_ptr<WorldGenerator> generator;
|
||||
|
||||
/* Average measured microseconds duration of loadVisible call */
|
||||
int64_t avgDurationMcs = 1000;
|
||||
/* Average measured microseconds duration of loadVisible call */
|
||||
int64_t avgDurationMcs = 1000;
|
||||
|
||||
/* Process one chunk: load it or calculate lights for it */
|
||||
bool loadVisible();
|
||||
/* Process one chunk: load it or calculate lights for it */
|
||||
bool loadVisible();
|
||||
public:
|
||||
ChunksController(Level* level, uint padding);
|
||||
~ChunksController();
|
||||
ChunksController(Level* level, uint padding);
|
||||
~ChunksController();
|
||||
|
||||
/* @param maxDuration milliseconds reserved for chunks loading */
|
||||
/* @param maxDuration milliseconds reserved for chunks loading */
|
||||
void update(int64_t maxDuration);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user