2012-02-13 13:47:03 -08:00
|
|
|
|
2011-12-25 18:39:43 -08:00
|
|
|
#pragma once
|
|
|
|
|
2012-02-13 13:47:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "cChunk.h"
|
|
|
|
#include "MersenneTwister.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-25 18:39:43 -08:00
|
|
|
class cWorldGenerator
|
|
|
|
{
|
|
|
|
public:
|
2012-02-16 09:45:26 -08:00
|
|
|
cWorldGenerator(cWorld * a_World);
|
2011-12-25 18:39:43 -08:00
|
|
|
~cWorldGenerator();
|
|
|
|
|
2012-02-18 09:53:22 -08:00
|
|
|
virtual void GenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, char * a_BlockData, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities);
|
2012-02-18 11:18:16 -08:00
|
|
|
|
|
|
|
virtual void PostGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Called when the chunk has been already generated and set valid
|
2011-12-25 18:39:43 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-02-16 09:45:26 -08:00
|
|
|
cWorld * m_World;
|
|
|
|
|
|
|
|
// Thread-unsafe:
|
2012-02-13 13:47:03 -08:00
|
|
|
MTRand r1;
|
|
|
|
|
2012-02-18 09:53:22 -08:00
|
|
|
static unsigned int MakeIndex(int x, int y, int z );
|
|
|
|
|
|
|
|
virtual void GenerateTerrain(int a_ChunkX, int a_ChunkY, int a_ChunkZ, char * a_BlockData);
|
|
|
|
|
2012-02-18 11:18:16 -08:00
|
|
|
virtual void GenerateFoliage(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
|
2012-02-13 13:47:03 -08:00
|
|
|
|
2012-02-18 11:18:16 -08:00
|
|
|
/// Checks if the chunk has all 8 neighbors valid, if so, foliage is generated on that chunk
|
|
|
|
void CheckNeighbors(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
|
2012-02-13 13:47:03 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-25 18:39:43 -08:00
|
|
|
|