diff options
author | worktycho <work.tycho@gmail.com> | 2013-12-09 18:51:12 +0100 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2013-12-09 18:51:12 +0100 |
commit | 843605d59ebc128be0a578dc6f45ef8c05da6e79 (patch) | |
tree | 3ffebc6ba27baf7a9e1d4bc51501ffeea9b14226 /source/Generating/HeiGen.h | |
parent | merged makefile changes (diff) | |
parent | Fix Undefined behavior at Bindings/LuaWindow line 32 (diff) | |
download | cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.gz cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.bz2 cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.lz cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.xz cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.tar.zst cuberite-843605d59ebc128be0a578dc6f45ef8c05da6e79.zip |
Diffstat (limited to 'source/Generating/HeiGen.h')
-rw-r--r-- | source/Generating/HeiGen.h | 141 |
1 files changed, 0 insertions, 141 deletions
diff --git a/source/Generating/HeiGen.h b/source/Generating/HeiGen.h deleted file mode 100644 index 437b5f104..000000000 --- a/source/Generating/HeiGen.h +++ /dev/null @@ -1,141 +0,0 @@ - -// HeiGen.h - -/* -Interfaces to the various height generators: - - cHeiGenFlat - - cHeiGenClassic - - cHeiGenBiomal -*/ - - - - - -#pragma once - -#include "ComposableGenerator.h" -#include "../Noise.h" - - - - - -class cHeiGenFlat : - public cTerrainHeightGen -{ -public: - cHeiGenFlat(int a_Height) : m_Height(a_Height) {} - -protected: - - int m_Height; - - // cTerrainHeightGen override: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; -} ; - - - - - -/// A simple cache that stores N most recently generated chunks' heightmaps; N being settable upon creation -class cHeiGenCache : - public cTerrainHeightGen -{ -public: - cHeiGenCache(cTerrainHeightGen * a_HeiGenToCache, int a_CacheSize); // Doesn't take ownership of a_HeiGenToCache - ~cHeiGenCache(); - - // cTerrainHeightGen override: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - - /// Retrieves height at the specified point in the cache, returns true if found, false if not found - bool GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height); - -protected: - - cTerrainHeightGen * m_HeiGenToCache; - - struct sCacheData - { - int m_ChunkX; - int m_ChunkZ; - cChunkDef::HeightMap m_HeightMap; - } ; - - // To avoid moving large amounts of data for the MRU behavior, we MRU-ize indices to an array of the actual data - int m_CacheSize; - int * m_CacheOrder; // MRU-ized order, indices into m_CacheData array - sCacheData * m_CacheData; // m_CacheData[m_CacheOrder[0]] is the most recently used - - // Cache statistics - int m_NumHits; - int m_NumMisses; - int m_TotalChain; // Number of cache items walked to get to a hit (only added for hits) -} ; - - - - - -class cHeiGenClassic : - public cTerrainHeightGen -{ -public: - cHeiGenClassic(int a_Seed, float a_HeightFreq1, float a_HeightAmp1, float a_HeightFreq2, float a_HeightAmp2, float a_HeightFreq3, float a_HeightAmp3); - -protected: - - int m_Seed; - cNoise m_Noise; - float m_HeightFreq1, m_HeightAmp1; - float m_HeightFreq2, m_HeightAmp2; - float m_HeightFreq3, m_HeightAmp3; - - float GetNoise(float x, float y); - - // cTerrainHeightGen override: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; -} ; - - - - - -class cHeiGenBiomal : - public cTerrainHeightGen -{ -public: - cHeiGenBiomal(int a_Seed, cBiomeGen & a_BiomeGen) : - m_Noise(a_Seed), - m_BiomeGen(a_BiomeGen) - { - } - -protected: - - typedef cChunkDef::BiomeMap BiomeNeighbors[3][3]; - - cNoise m_Noise; - cBiomeGen & m_BiomeGen; - - // Per-biome terrain generator parameters: - struct sGenParam - { - float m_HeightFreq1, m_HeightAmp1; - float m_HeightFreq2, m_HeightAmp2; - float m_HeightFreq3, m_HeightAmp3; - float m_BaseHeight; - } ; - static const sGenParam m_GenParam[biNumBiomes]; - - // cTerrainHeightGen override: - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override; - - NOISE_DATATYPE GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX, int a_ChunkZ, const BiomeNeighbors & a_BiomeNeighbors); -} ; - - - - |