mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 20:41:49 +00:00
move Chunks from Level to Player
This commit is contained in:
parent
b7664b4188
commit
1c18c02092
40 changed files with 450 additions and 220 deletions
|
|
@ -7,6 +7,7 @@
|
|||
class Level;
|
||||
class Chunk;
|
||||
class Chunks;
|
||||
class Player;
|
||||
class Lighting;
|
||||
class WorldGenerator;
|
||||
|
||||
|
|
@ -14,14 +15,13 @@ class WorldGenerator;
|
|||
class ChunksController {
|
||||
private:
|
||||
Level& level;
|
||||
Chunks& chunks;
|
||||
uint padding;
|
||||
std::unique_ptr<WorldGenerator> generator;
|
||||
|
||||
/// @brief Process one chunk: load it or calculate lights for it
|
||||
bool loadVisible();
|
||||
bool buildLights(const std::shared_ptr<Chunk>& chunk);
|
||||
void createChunk(int x, int y);
|
||||
bool loadVisible(const Player& player) const;
|
||||
bool buildLights(const Player& player, const std::shared_ptr<Chunk>& chunk) const;
|
||||
void createChunk(const Player& player, int x, int y) const;
|
||||
public:
|
||||
std::unique_ptr<Lighting> lighting;
|
||||
|
||||
|
|
@ -29,11 +29,7 @@ public:
|
|||
~ChunksController();
|
||||
|
||||
/// @param maxDuration milliseconds reserved for chunks loading
|
||||
void update(
|
||||
int64_t maxDuration,
|
||||
int loadDistance,
|
||||
int centerX,
|
||||
int centerY);
|
||||
void update(int64_t maxDuration, int loadDistance, Player& player) const;
|
||||
|
||||
const WorldGenerator* getGenerator() const {
|
||||
return generator.get();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue