Added Comments
Added ability to hold shift and skip the terrain generation when loading Added ability for the perlin terrain to save a raw image of the terrain to use as a cache
This commit is contained in:
@ -3,9 +3,11 @@
|
||||
#include <vector>
|
||||
#include <numeric>
|
||||
#include <random>
|
||||
#include <fstream>
|
||||
#include "SharedMethods.h"
|
||||
#include "TerrainNode.h"
|
||||
|
||||
// Class for generating a terrain using a perlin noise algorithm, this now caches the result too so it only has to run on the initial time its loaded.
|
||||
class PerlinTerrainNode : public TerrainNode
|
||||
{
|
||||
public:
|
||||
@ -41,11 +43,20 @@ private:
|
||||
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
|
||||
};
|
||||
|
||||
// Vector to hold the actual randomised perlin noise permutation array
|
||||
vector<unsigned char> _p;
|
||||
|
||||
// The chunk size lets us control how large a noise spot should be, lower numbers will make things flatter, larger numbers will make things spikey
|
||||
float _chunkSize;
|
||||
|
||||
// Methods for Caching the output to a raw image format, and reading it back in the next time its loaded
|
||||
bool ReadCache();
|
||||
void CacheOutput();
|
||||
|
||||
// Methods for fading a number, used for the noise calculation
|
||||
float Fade(float t);
|
||||
|
||||
// Method for generating a perlin gradient.
|
||||
float Grad(int hash, float x, float y);
|
||||
|
||||
void GeneratePerlinValues();
|
||||
|
Reference in New Issue
Block a user