From 113b54aefda025f3cb47d5285e12104e8681506e Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 27 Sep 2014 22:01:47 +0200 Subject: BioGen: TwoLevel is now fully settable in INI. --- src/Generating/BioGen.cpp | 60 +++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 38 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 3ee0bd4c5..8924a7999 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -737,8 +737,6 @@ void cBioGenMultiStepMap::FreezeWaterBiomes(cChunkDef::BiomeMap & a_BiomeMap, co cBioGenTwoLevel::cBioGenTwoLevel(int a_Seed) : m_VoronoiLarge(a_Seed + 1000), m_VoronoiSmall(a_Seed + 2000), - m_DistortX(a_Seed + 3000), - m_DistortZ(a_Seed + 4000), m_Noise1(a_Seed + 5001), m_Noise2(a_Seed + 5002), m_Noise3(a_Seed + 5003), @@ -762,19 +760,17 @@ void cBioGenTwoLevel::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1]; for (int x = 0; x <= 4; x++) for (int z = 0; z <= 4; z++) { - int BlockX = BaseX + x * 4; - int BlockZ = BaseZ + z * 4; - float BlockXF = (float)(16 * BlockX) / 128; - float BlockZF = (float)(16 * BlockZ) / 128; - double NoiseX = m_Noise1.CubicNoise2D(BlockXF / 16, BlockZF / 16); - NoiseX += 0.5 * m_Noise2.CubicNoise2D(BlockXF / 8, BlockZF / 8); - NoiseX += 0.08 * m_Noise3.CubicNoise2D(BlockXF, BlockZF); - double NoiseZ = m_Noise4.CubicNoise2D(BlockXF / 16, BlockZF / 16); - NoiseZ += 0.5 * m_Noise5.CubicNoise2D(BlockXF / 8, BlockZF / 8); - NoiseZ += 0.08 * m_Noise6.CubicNoise2D(BlockXF, BlockZF); + float BlockX = BaseX + x * 4; + float BlockZ = BaseZ + z * 4; + double NoiseX = m_AmpX1 * m_Noise1.CubicNoise2D(BlockX * m_FreqX1, BlockZ * m_FreqX1); + NoiseX += m_AmpX2 * m_Noise2.CubicNoise2D(BlockX * m_FreqX2, BlockZ * m_FreqX2); + NoiseX += m_AmpX3 * m_Noise3.CubicNoise2D(BlockX * m_FreqX3, BlockZ * m_FreqX3); + double NoiseZ = m_AmpZ1 * m_Noise4.CubicNoise2D(BlockX * m_FreqZ1, BlockZ * m_FreqZ1); + NoiseZ += m_AmpZ2 * m_Noise5.CubicNoise2D(BlockX * m_FreqZ2, BlockZ * m_FreqZ2); + NoiseZ += m_AmpZ3 * m_Noise6.CubicNoise2D(BlockX * m_FreqZ3, BlockZ * m_FreqZ3); - DistortX[4 * x][4 * z] = BlockX + (int)(64 * NoiseX); - DistortZ[4 * x][4 * z] = BlockZ + (int)(64 * NoiseZ); + DistortX[4 * x][4 * z] = (int)(BlockX + NoiseX); + DistortZ[4 * x][4 * z] = (int)(BlockZ + NoiseZ); } LinearUpscale2DArrayInPlace(&DistortX[0][0]); @@ -915,30 +911,18 @@ void cBioGenTwoLevel::InitializeBiomeGen(cIniFile & a_IniFile) { m_VoronoiLarge.SetCellSize(a_IniFile.GetValueSetI("Generator", "TwoLevelLargeCellSize", 1024)); m_VoronoiSmall.SetCellSize(a_IniFile.GetValueSetI("Generator", "TwoLevelSmallCellSize", 128)); - m_DistortX.AddOctave( - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Freq", 0.01), - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Amp", 16) - ); - m_DistortX.AddOctave( - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Freq", 0.005), - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Amp", 8) - ); - m_DistortX.AddOctave( - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Freq", 0.0025), - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Amp", 4) - ); - m_DistortZ.AddOctave( - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Freq", 0.01), - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Amp", 16) - ); - m_DistortZ.AddOctave( - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Freq", 0.005), - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Amp", 8) - ); - m_DistortZ.AddOctave( - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Freq", 0.0025), - (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Amp", 4) - ); + m_FreqX1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Freq", 0.01); + m_AmpX1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave1Amp", 80); + m_FreqX2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Freq", 0.05); + m_AmpX2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave2Amp", 20); + m_FreqX3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Freq", 0.1), + m_AmpX3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortXOctave3Amp", 8); + m_FreqZ1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Freq", 0.01); + m_AmpZ1 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave1Amp", 80); + m_FreqZ2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Freq", 0.05); + m_AmpZ2 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave2Amp", 20); + m_FreqZ3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Freq", 0.1); + m_AmpZ3 = (float)a_IniFile.GetValueSetF("Generator", "TwoLevelDistortZOctave3Amp", 8); } -- cgit v1.2.3 From 799ae87d3fe17e37462cf26f902fdc3565e4b562 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 16 Oct 2014 11:00:15 +0200 Subject: BioGen: Fixed a compiler warning. --- src/Generating/BioGen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 8924a7999..9b3d4e98d 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -760,8 +760,8 @@ void cBioGenTwoLevel::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1]; for (int x = 0; x <= 4; x++) for (int z = 0; z <= 4; z++) { - float BlockX = BaseX + x * 4; - float BlockZ = BaseZ + z * 4; + float BlockX = static_cast(BaseX + x * 4); + float BlockZ = static_cast(BaseZ + z * 4); double NoiseX = m_AmpX1 * m_Noise1.CubicNoise2D(BlockX * m_FreqX1, BlockZ * m_FreqX1); NoiseX += m_AmpX2 * m_Noise2.CubicNoise2D(BlockX * m_FreqX2, BlockZ * m_FreqX2); NoiseX += m_AmpX3 * m_Noise3.CubicNoise2D(BlockX * m_FreqX3, BlockZ * m_FreqX3); -- cgit v1.2.3 From e0cfbc4d8526a1a1d3afa8fc0774358f4f18b7e2 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 19 Oct 2014 14:01:59 +0200 Subject: Generator: Rewritten to use SharedPtrs. --- src/Generating/BioGen.cpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 9b3d4e98d..f5fe3e980 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -45,7 +45,7 @@ void cBioGenConstant::InitializeBiomeGen(cIniFile & a_IniFile) //////////////////////////////////////////////////////////////////////////////// // cBioGenCache: -cBioGenCache::cBioGenCache(cBiomeGen * a_BioGenToCache, int a_CacheSize) : +cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, int a_CacheSize) : m_BioGenToCache(a_BioGenToCache), m_CacheSize(a_CacheSize), m_CacheOrder(new int[a_CacheSize]), @@ -145,25 +145,13 @@ void cBioGenCache::InitializeBiomeGen(cIniFile & a_IniFile) //////////////////////////////////////////////////////////////////////////////// // cBioGenMulticache: -cBioGenMulticache::cBioGenMulticache(cBiomeGen * a_BioGenToCache, size_t a_CacheSize, size_t a_CachesLength) : - m_CachesLength(a_CachesLength) +cBioGenMulticache::cBioGenMulticache(cBiomeGenPtr a_BioGenToCache, size_t a_SubCacheSize, size_t a_NumSubCaches) : + m_NumSubCaches(a_NumSubCaches) { - m_Caches.reserve(a_CachesLength); - for (size_t i = 0; i < a_CachesLength; i++) + m_Caches.reserve(a_NumSubCaches); + for (size_t i = 0; i < a_NumSubCaches; i++) { - m_Caches.push_back(new cBioGenCache(a_BioGenToCache, a_CacheSize)); - } -} - - - - - -cBioGenMulticache::~cBioGenMulticache() -{ - for (cBiomeGens::iterator it = m_Caches.begin(); it != m_Caches.end(); it++) - { - delete *it; + m_Caches.push_back(cBiomeGenPtr(new cBioGenCache(a_BioGenToCache, a_SubCacheSize))); } } @@ -174,7 +162,7 @@ cBioGenMulticache::~cBioGenMulticache() void cBioGenMulticache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) { const size_t coefficient = 3; - const size_t cacheIdx = ((size_t)a_ChunkX + coefficient * (size_t)a_ChunkZ) % m_CachesLength; + const size_t cacheIdx = ((size_t)a_ChunkX + coefficient * (size_t)a_ChunkZ) % m_NumSubCaches; m_Caches[cacheIdx]->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap); } @@ -185,10 +173,9 @@ void cBioGenMulticache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMa void cBioGenMulticache::InitializeBiomeGen(cIniFile & a_IniFile) { - for (cBiomeGens::iterator it = m_Caches.begin(); it != m_Caches.end(); it++) + for (auto itr : m_Caches) { - cBiomeGen * tmp = *it; - tmp->InitializeBiomeGen(a_IniFile); + itr->InitializeBiomeGen(a_IniFile); } } @@ -932,7 +919,7 @@ void cBioGenTwoLevel::InitializeBiomeGen(cIniFile & a_IniFile) //////////////////////////////////////////////////////////////////////////////// // cBiomeGen: -cBiomeGen * cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a_CacheOffByDefault) +cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a_CacheOffByDefault) { AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", ""); if (BiomeGenName.empty()) @@ -988,7 +975,7 @@ cBiomeGen * cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & a } res->InitializeBiomeGen(a_IniFile); - return res; + return cBiomeGenPtr(res); } -- cgit v1.2.3 From 262e6d06aa3ce18eb8f676a0fa659085ef11d9e4 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 19 Oct 2014 16:07:29 +0200 Subject: TwoLevel BioGen: fixed swapped inside and outside biomes. --- src/Generating/BioGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index f5fe3e980..b9face1f8 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -772,7 +772,7 @@ void cBioGenTwoLevel::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap int BiomeGroup = m_VoronoiLarge.GetValueAt(DistortX[x][z], DistortZ[x][z], SeedX, SeedZ, MinDist2) / 7; int BiomeIdx = m_VoronoiSmall.GetValueAt(DistortX[x][z], DistortZ[x][z], SeedX, SeedZ, MinDist2) / 11; int MinDist1 = (DistortX[x][z] - SeedX) * (DistortX[x][z] - SeedX) + (DistortZ[x][z] - SeedZ) * (DistortZ[x][z] - SeedZ); - cChunkDef::SetBiome(a_BiomeMap, x, z, SelectBiome(BiomeGroup, BiomeIdx, (MinDist1 < MinDist2 / 4) ? 0 : 1)); + cChunkDef::SetBiome(a_BiomeMap, x, z, SelectBiome(BiomeGroup, BiomeIdx, (MinDist1 < MinDist2 / 4) ? 1 : 0)); } } } -- cgit v1.2.3 From a26541a7c3ced0569098edd0aae61c097c2912f4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 20 Oct 2014 21:55:07 +0100 Subject: En masse NULL -> nullptr replace --- src/Generating/BioGen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index b9face1f8..d86d44bbc 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -69,9 +69,9 @@ cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, int a_CacheSize) : cBioGenCache::~cBioGenCache() { delete[] m_CacheData; - m_CacheData = NULL; + m_CacheData = nullptr; delete[] m_CacheOrder; - m_CacheOrder = NULL; + m_CacheOrder = nullptr; } @@ -928,7 +928,7 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & BiomeGenName = "MultiStepMap"; } - cBiomeGen * res = NULL; + cBiomeGen * res = nullptr; a_CacheOffByDefault = false; if (NoCaseCompare(BiomeGenName, "constant") == 0) { -- cgit v1.2.3 From 449d08cb3d1a8ef430430790fcea0ce36b713866 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 23 Oct 2014 15:15:10 +0200 Subject: Merged IniFile into main MCS sources. --- src/Generating/BioGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index d86d44bbc..203faff56 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -5,7 +5,7 @@ #include "Globals.h" #include "BioGen.h" -#include "inifile/iniFile.h" +#include "../IniFile.h" #include "../LinearUpscale.h" -- cgit v1.2.3 From 7e1d603080146047bade80ee70982dbe569cdf30 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 26 Oct 2014 19:58:16 +0100 Subject: Added new biomegen: Grown --- src/Generating/BioGen.cpp | 93 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 203faff56..c9405040f 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -5,6 +5,7 @@ #include "Globals.h" #include "BioGen.h" +#include "IntGen.h" #include "../IniFile.h" #include "../LinearUpscale.h" @@ -916,6 +917,94 @@ void cBioGenTwoLevel::InitializeBiomeGen(cIniFile & a_IniFile) +//////////////////////////////////////////////////////////////////////////////// +// cBioGenGrown: + +class cBioGenGrown: + public cBiomeGen +{ +public: + cBioGenGrown(int a_Seed) + { + auto FinalRivers = + std::make_shared> (a_Seed + 1, + std::make_shared> (a_Seed + 2, + std::make_shared> (a_Seed + 3, + std::make_shared> (a_Seed + 4, + std::make_shared> (a_Seed + 5, + std::make_shared> (a_Seed + 6, + std::make_shared> (a_Seed + 7, + std::make_shared> (a_Seed + 8, + std::make_shared> (a_Seed + 9, + std::make_shared> (a_Seed + 10, + std::make_shared> (a_Seed + 11, + std::make_shared>(a_Seed + 12 + )))))))))))); + + auto FinalBiomes = + std::make_shared> (a_Seed + 1008, + std::make_shared>(a_Seed + 15, + std::make_shared> (a_Seed + 1000, + std::make_shared> (a_Seed + 16, + std::make_shared> (a_Seed + 1001, + std::make_shared> (a_Seed, + std::make_shared> (a_Seed + 1002, + std::make_shared> (a_Seed + 1, + std::make_shared> ( + std::make_shared> (a_Seed + 1002, + std::make_shared>(a_Seed + 2, + std::make_shared> (a_Seed + 3, + std::make_shared> (a_Seed + 2004, 10, + std::make_shared> (a_Seed + 4, + std::make_shared> (a_Seed + 9, 50, biMushroomIsland, + std::make_shared> (a_Seed + 8, + std::make_shared> (a_Seed + 10, 500, biDeepOcean, + std::make_shared> (a_Seed + 3000, + std::make_shared> (a_Seed + 5, + std::make_shared> ( + std::make_shared> (a_Seed + 1003, + std::make_shared> (a_Seed + 7, + std::make_shared> (bgJungle, bgTemperate, 50, a_Seed + 100, + std::make_shared> (bgIce, bgTemperate, 50, a_Seed + 101, + std::make_shared> (a_Seed + 2000, 70, + std::make_shared> (a_Seed + 1004, + std::make_shared> (a_Seed + 10, + std::make_shared> (a_Seed + 2003, 50, + std::make_shared> (a_Seed + 11, + std::make_shared> (a_Seed + 100, 65 + )))))))))))))))))))))))))))))); + + m_Gen = + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared> ( + FinalBiomes, FinalRivers + ))))); + } + + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override + { + cIntGen<16, 16>::Values vals; + m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, vals); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetBiome(a_Biomes, x, z, (EMCSBiome)vals[x + cChunkDef::Width * z]); + } + } + } + +protected: + cIntGenPtr<16, 16> m_Gen; +}; + + + + + //////////////////////////////////////////////////////////////////////////////// // cBiomeGen: @@ -952,6 +1041,10 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & { res = new cBioGenTwoLevel(a_Seed); } + else if (NoCaseCompare(BiomeGenName, "grown") == 0) + { + res = new cBioGenGrown(a_Seed); + } else { if (NoCaseCompare(BiomeGenName, "multistepmap") != 0) -- cgit v1.2.3 From 74df4618de1c52c22f892e0bf82ec612521a10c0 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 26 Oct 2014 22:56:02 +0100 Subject: BioGenGrown: Smaller biomes, add land to map center. --- src/Generating/BioGen.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index c9405040f..fcb4d74ed 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -969,10 +969,8 @@ public: std::make_shared> (a_Seed + 2000, 70, std::make_shared> (a_Seed + 1004, std::make_shared> (a_Seed + 10, - std::make_shared> (a_Seed + 2003, 50, - std::make_shared> (a_Seed + 11, - std::make_shared> (a_Seed + 100, 65 - )))))))))))))))))))))))))))))); + std::make_shared> (a_Seed + 100, 65 + )))))))))))))))))))))))))))); m_Gen = std::make_shared>(a_Seed, -- cgit v1.2.3 From 7d08d34693706ef70cff6cfc796d4f7cbd396bc5 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 27 Oct 2014 09:35:21 +0100 Subject: Removed too advanced C++11 features. We need to keep gcc 4.6 compatibility; these features were not implemented in that version yet. --- src/Generating/BioGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index fcb4d74ed..96c181915 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -996,7 +996,7 @@ public: } protected: - cIntGenPtr<16, 16> m_Gen; + std::shared_ptr> m_Gen; }; -- cgit v1.2.3 From f34b1291beb81b4fcf82e155e66f4a43d7caf915 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 29 Oct 2014 15:28:27 +0100 Subject: Grown biomes: made biomes smaller, made beaches smaller. --- src/Generating/BioGen.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 96c181915..6fab1b9d9 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -946,18 +946,15 @@ public: std::make_shared>(a_Seed + 15, std::make_shared> (a_Seed + 1000, std::make_shared> (a_Seed + 16, - std::make_shared> (a_Seed + 1001, - std::make_shared> (a_Seed, - std::make_shared> (a_Seed + 1002, - std::make_shared> (a_Seed + 1, std::make_shared> ( std::make_shared> (a_Seed + 1002, - std::make_shared>(a_Seed + 2, - std::make_shared> (a_Seed + 3, - std::make_shared> (a_Seed + 2004, 10, - std::make_shared> (a_Seed + 4, - std::make_shared> (a_Seed + 9, 50, biMushroomIsland, - std::make_shared> (a_Seed + 8, + std::make_shared>(a_Seed + 1, + std::make_shared> (a_Seed + 1002, + std::make_shared> (a_Seed + 2, + std::make_shared> (a_Seed + 2004, 10, + std::make_shared> (a_Seed + 4, + std::make_shared> (a_Seed + 9, 50, biMushroomIsland, + std::make_shared> (a_Seed + 8, std::make_shared> (a_Seed + 10, 500, biDeepOcean, std::make_shared> (a_Seed + 3000, std::make_shared> (a_Seed + 5, @@ -970,7 +967,7 @@ public: std::make_shared> (a_Seed + 1004, std::make_shared> (a_Seed + 10, std::make_shared> (a_Seed + 100, 65 - )))))))))))))))))))))))))))); + ))))))))))))))))))))))))); m_Gen = std::make_shared>(a_Seed, -- cgit v1.2.3 From 8c04abf9aa749af3b15bc92f517b636c9593109e Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 30 Oct 2014 16:24:35 +0100 Subject: QtBiomeVisualiser: Added a prototyping int generator flavor. This generator is easier to manipulate, since it doesn't require rewriting the sizes in the template parameters. On the other hand, it doesn't optimize so well, so it's a bit slower. --- src/Generating/BioGen.cpp | 124 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 13 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 6fab1b9d9..f9a0a571b 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -6,6 +6,7 @@ #include "Globals.h" #include "BioGen.h" #include "IntGen.h" +#include "ProtIntGen.h" #include "../IniFile.h" #include "../LinearUpscale.h" @@ -927,9 +928,9 @@ public: cBioGenGrown(int a_Seed) { auto FinalRivers = - std::make_shared> (a_Seed + 1, - std::make_shared> (a_Seed + 2, - std::make_shared> (a_Seed + 3, + std::make_shared> (a_Seed + 1, + std::make_shared> (a_Seed + 3, + std::make_shared> (a_Seed + 2, std::make_shared> (a_Seed + 4, std::make_shared> (a_Seed + 5, std::make_shared> (a_Seed + 6, @@ -942,10 +943,10 @@ public: )))))))))))); auto FinalBiomes = - std::make_shared> (a_Seed + 1008, - std::make_shared>(a_Seed + 15, - std::make_shared> (a_Seed + 1000, - std::make_shared> (a_Seed + 16, + std::make_shared> (a_Seed + 1008, + std::make_shared>(a_Seed + 15, + std::make_shared> (a_Seed + 1000, + std::make_shared> (a_Seed + 16, std::make_shared> ( std::make_shared> (a_Seed + 1002, std::make_shared>(a_Seed + 1, @@ -953,7 +954,8 @@ public: std::make_shared> (a_Seed + 2, std::make_shared> (a_Seed + 2004, 10, std::make_shared> (a_Seed + 4, - std::make_shared> (a_Seed + 9, 50, biMushroomIsland, + std::make_shared> (a_Seed + 9, 10, biMushroomIsland, + std::make_shared> (biIcePlains, biIcePlainsSpikes, 5, a_Seed + 99, std::make_shared> (a_Seed + 8, std::make_shared> (a_Seed + 10, 500, biDeepOcean, std::make_shared> (a_Seed + 3000, @@ -961,22 +963,26 @@ public: std::make_shared> ( std::make_shared> (a_Seed + 1003, std::make_shared> (a_Seed + 7, + std::make_shared> (a_Seed + 8, 50, bgOcean, std::make_shared> (bgJungle, bgTemperate, 50, a_Seed + 100, std::make_shared> (bgIce, bgTemperate, 50, a_Seed + 101, + std::make_shared> (bgDesert, bgMesa, 30, a_Seed + 102, std::make_shared> (a_Seed + 2000, 70, + std::make_shared> (a_Seed + 9, 50, bgOcean, std::make_shared> (a_Seed + 1004, std::make_shared> (a_Seed + 10, std::make_shared> (a_Seed + 100, 65 - ))))))))))))))))))))))))); + ))))))))))))))))))))))))))))); m_Gen = std::make_shared>(a_Seed, std::make_shared>(a_Seed, - std::make_shared>(a_Seed, - std::make_shared>(a_Seed, - std::make_shared> ( + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared> ( FinalBiomes, FinalRivers - ))))); + )))))); } virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override @@ -1000,6 +1006,94 @@ protected: +//////////////////////////////////////////////////////////////////////////////// +// cBioGenGrown: + +class cBioGenProtGrown: + public cBiomeGen +{ +public: + cBioGenProtGrown(int a_Seed) + { + auto FinalRivers = + std::make_shared(a_Seed + 1, + std::make_shared(a_Seed + 3, + std::make_shared(a_Seed + 2, + std::make_shared(a_Seed + 4, + std::make_shared(a_Seed + 5, + std::make_shared(a_Seed + 6, + std::make_shared(a_Seed + 7, + std::make_shared(a_Seed + 8, + std::make_shared(a_Seed + 9, + std::make_shared(a_Seed + 10, + std::make_shared(a_Seed + 11, + std::make_shared(a_Seed + 12, 2 + )))))))))))); + + auto FinalBiomes = + std::make_shared(a_Seed + 1008, + std::make_shared(a_Seed + 15, + std::make_shared(a_Seed + 1000, + std::make_shared(a_Seed + 16, + std::make_shared( + std::make_shared(a_Seed + 1002, + std::make_shared(a_Seed + 1, + std::make_shared(a_Seed + 1002, + std::make_shared(a_Seed + 2, + std::make_shared(a_Seed + 2004, 10, + std::make_shared(a_Seed + 4, + std::make_shared(a_Seed + 9, 10, biMushroomIsland, + std::make_shared(biIcePlains, biIcePlainsSpikes, 5, a_Seed + 99, + std::make_shared(a_Seed + 8, + std::make_shared(a_Seed + 10, 500, biDeepOcean, + std::make_shared(a_Seed + 3000, + std::make_shared(a_Seed + 5, + std::make_shared( + std::make_shared(a_Seed + 1003, + std::make_shared(a_Seed + 7, + std::make_shared(a_Seed + 8, 50, bgOcean, + std::make_shared(bgJungle, bgTemperate, 50, a_Seed + 100, + std::make_shared(bgIce, bgTemperate, 50, a_Seed + 101, + std::make_shared(bgDesert, bgMesa, 30, a_Seed + 102, + std::make_shared(a_Seed + 2000, 70, + std::make_shared(a_Seed + 9, 50, bgOcean, + std::make_shared(a_Seed + 1004, + std::make_shared(a_Seed + 10, + std::make_shared(a_Seed + 100, 65 + ))))))))))))))))))))))))))))); + + m_Gen = + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared(a_Seed, + std::make_shared( + FinalBiomes, FinalRivers + )))))); + } + + virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override + { + int vals[16 * 16]; + m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, 16, 16, vals); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetBiome(a_Biomes, x, z, (EMCSBiome)vals[x + cChunkDef::Width * z]); + } + } + } + +protected: + std::shared_ptr m_Gen; +}; + + + + + //////////////////////////////////////////////////////////////////////////////// // cBiomeGen: @@ -1040,6 +1134,10 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & { res = new cBioGenGrown(a_Seed); } + else if (NoCaseCompare(BiomeGenName, "grownprot") == 0) + { + res = new cBioGenProtGrown(a_Seed); + } else { if (NoCaseCompare(BiomeGenName, "multistepmap") != 0) -- cgit v1.2.3 From 13f0e93d690ef5ca96689190356b5c6c9cceb434 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Fri, 31 Oct 2014 12:52:07 +0100 Subject: GrownProt biomes: added alterations. --- src/Generating/BioGen.cpp | 56 +++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 26 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index f9a0a571b..b3701a32a 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -964,15 +964,13 @@ public: std::make_shared> (a_Seed + 1003, std::make_shared> (a_Seed + 7, std::make_shared> (a_Seed + 8, 50, bgOcean, - std::make_shared> (bgJungle, bgTemperate, 50, a_Seed + 100, std::make_shared> (bgIce, bgTemperate, 50, a_Seed + 101, - std::make_shared> (bgDesert, bgMesa, 30, a_Seed + 102, std::make_shared> (a_Seed + 2000, 70, std::make_shared> (a_Seed + 9, 50, bgOcean, std::make_shared> (a_Seed + 1004, std::make_shared> (a_Seed + 10, std::make_shared> (a_Seed + 100, 65 - ))))))))))))))))))))))))))))); + ))))))))))))))))))))))))))); m_Gen = std::make_shared>(a_Seed, @@ -1017,60 +1015,66 @@ public: { auto FinalRivers = std::make_shared(a_Seed + 1, - std::make_shared(a_Seed + 3, - std::make_shared(a_Seed + 2, - std::make_shared(a_Seed + 4, - std::make_shared(a_Seed + 5, - std::make_shared(a_Seed + 6, - std::make_shared(a_Seed + 7, + std::make_shared(a_Seed + 2, + std::make_shared(a_Seed + 3, + std::make_shared(a_Seed + 4, + std::make_shared(a_Seed + 5, std::make_shared(a_Seed + 8, + std::make_shared(a_Seed + 5, std::make_shared(a_Seed + 9, + std::make_shared(a_Seed + 5, std::make_shared(a_Seed + 10, + std::make_shared(a_Seed + 5, + std::make_shared(a_Seed + 5, std::make_shared(a_Seed + 11, std::make_shared(a_Seed + 12, 2 - )))))))))))); + )))))))))))))); + + auto alteration = + std::make_shared(a_Seed, + std::make_shared(a_Seed, 20 + )); auto FinalBiomes = - std::make_shared(a_Seed + 1008, + std::make_shared(a_Seed + 1, std::make_shared(a_Seed + 15, - std::make_shared(a_Seed + 1000, + std::make_shared(a_Seed + 1, std::make_shared(a_Seed + 16, std::make_shared( - std::make_shared(a_Seed + 1002, std::make_shared(a_Seed + 1, - std::make_shared(a_Seed + 1002, std::make_shared(a_Seed + 2, std::make_shared(a_Seed + 2004, 10, + std::make_shared(a_Seed + 10, 500, biDeepOcean, + std::make_shared(a_Seed + 1, biPlains, biSunflowerPlains, 20, + std::make_shared(a_Seed + 1, alteration, std::make_shared(a_Seed + 4, - std::make_shared(a_Seed + 9, 10, biMushroomIsland, - std::make_shared(biIcePlains, biIcePlainsSpikes, 5, a_Seed + 99, + std::make_shared(a_Seed + 99, biIcePlains, biIcePlainsSpikes, 50, std::make_shared(a_Seed + 8, - std::make_shared(a_Seed + 10, 500, biDeepOcean, + std::make_shared(a_Seed + 10, 300, biDeepOcean, + std::make_shared(a_Seed + 9, 8, biMushroomIsland, std::make_shared(a_Seed + 3000, + std::make_shared(a_Seed + 2000, 200, std::make_shared(a_Seed + 5, + std::make_shared(a_Seed + 5, 50, std::make_shared( - std::make_shared(a_Seed + 1003, + std::make_shared(a_Seed + 2000, 200, std::make_shared(a_Seed + 7, std::make_shared(a_Seed + 8, 50, bgOcean, - std::make_shared(bgJungle, bgTemperate, 50, a_Seed + 100, - std::make_shared(bgIce, bgTemperate, 50, a_Seed + 101, - std::make_shared(bgDesert, bgMesa, 30, a_Seed + 102, - std::make_shared(a_Seed + 2000, 70, + std::make_shared(a_Seed + 101, bgIce, bgTemperate, 150, + std::make_shared(a_Seed + 2000, 200, std::make_shared(a_Seed + 9, 50, bgOcean, - std::make_shared(a_Seed + 1004, std::make_shared(a_Seed + 10, - std::make_shared(a_Seed + 100, 65 + std::make_shared(a_Seed + 100, 30 ))))))))))))))))))))))))))))); m_Gen = std::make_shared(a_Seed, std::make_shared(a_Seed, - std::make_shared(a_Seed, std::make_shared(a_Seed, std::make_shared(a_Seed, std::make_shared( FinalBiomes, FinalRivers - )))))); + ))))); } virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override -- cgit v1.2.3 From 4873890cfbb0c1a2ede464c44ffb58bfe4a1c1cd Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 1 Nov 2014 16:37:56 +0100 Subject: GrownProt biome gen: Added biome edges. --- src/Generating/BioGen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index b3701a32a..e4a3a3629 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -1042,11 +1042,12 @@ public: std::make_shared(a_Seed + 16, std::make_shared( std::make_shared(a_Seed + 1, - std::make_shared(a_Seed + 2, std::make_shared(a_Seed + 2004, 10, std::make_shared(a_Seed + 10, 500, biDeepOcean, std::make_shared(a_Seed + 1, biPlains, biSunflowerPlains, 20, std::make_shared(a_Seed + 1, alteration, + std::make_shared(a_Seed + 3, + std::make_shared(a_Seed + 2, std::make_shared(a_Seed + 4, std::make_shared(a_Seed + 99, biIcePlains, biIcePlainsSpikes, 50, std::make_shared(a_Seed + 8, @@ -1065,7 +1066,7 @@ public: std::make_shared(a_Seed + 9, 50, bgOcean, std::make_shared(a_Seed + 10, std::make_shared(a_Seed + 100, 30 - ))))))))))))))))))))))))))))); + )))))))))))))))))))))))))))))); m_Gen = std::make_shared(a_Seed, -- cgit v1.2.3 From d868346491cf35ea9d52d60786904b0552d9d67c Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 1 Nov 2014 21:01:33 +0100 Subject: GrownProt: Added the rest of rare and M biomes. --- src/Generating/BioGen.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index e4a3a3629..dc5f715ca 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -1035,6 +1035,14 @@ public: std::make_shared(a_Seed, 20 )); + auto alteration2 = + std::make_shared(a_Seed + 1, + std::make_shared(a_Seed + 2, + std::make_shared(a_Seed + 1, + std::make_shared(a_Seed + 2, + std::make_shared(a_Seed + 1, 10 + ))))); + auto FinalBiomes = std::make_shared(a_Seed + 1, std::make_shared(a_Seed + 15, @@ -1045,6 +1053,7 @@ public: std::make_shared(a_Seed + 2004, 10, std::make_shared(a_Seed + 10, 500, biDeepOcean, std::make_shared(a_Seed + 1, biPlains, biSunflowerPlains, 20, + std::make_shared(a_Seed + 5, alteration2, std::make_shared(a_Seed + 1, alteration, std::make_shared(a_Seed + 3, std::make_shared(a_Seed + 2, @@ -1066,7 +1075,7 @@ public: std::make_shared(a_Seed + 9, 50, bgOcean, std::make_shared(a_Seed + 10, std::make_shared(a_Seed + 100, 30 - )))))))))))))))))))))))))))))); + ))))))))))))))))))))))))))))))); m_Gen = std::make_shared(a_Seed, -- cgit v1.2.3 From d5b6353493868ac14b277155f398bd87f08c484c Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 2 Nov 2014 16:36:59 +0100 Subject: Grown biomes: Unified with GrownProt biomes. Also fixed a Zoom filter randomness. --- src/Generating/BioGen.cpp | 104 +++++++++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 43 deletions(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index dc5f715ca..0f2b0a73d 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -928,59 +928,77 @@ public: cBioGenGrown(int a_Seed) { auto FinalRivers = - std::make_shared> (a_Seed + 1, - std::make_shared> (a_Seed + 3, - std::make_shared> (a_Seed + 2, - std::make_shared> (a_Seed + 4, - std::make_shared> (a_Seed + 5, - std::make_shared> (a_Seed + 6, - std::make_shared> (a_Seed + 7, - std::make_shared> (a_Seed + 8, - std::make_shared> (a_Seed + 9, - std::make_shared> (a_Seed + 10, - std::make_shared> (a_Seed + 11, - std::make_shared>(a_Seed + 12 - )))))))))))); + std::make_shared> (a_Seed + 1, + std::make_shared> (a_Seed + 2, + std::make_shared> (a_Seed + 3, + std::make_shared> (a_Seed + 4, + std::make_shared> (a_Seed + 5, + std::make_shared> (a_Seed + 8, + std::make_shared> (a_Seed + 5, + std::make_shared> (a_Seed + 9, + std::make_shared> (a_Seed + 5, + std::make_shared> (a_Seed + 10, + std::make_shared> (a_Seed + 5, + std::make_shared> (a_Seed + 6, + std::make_shared> (a_Seed + 11, + std::make_shared>(a_Seed + 12 + )))))))))))))); + + auto alteration = + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, 20 + )); + + auto alteration2 = + std::make_shared>(a_Seed + 1, + std::make_shared>(a_Seed + 2, + std::make_shared>(a_Seed + 1, + std::make_shared>(a_Seed + 2, + std::make_shared>(a_Seed + 1, 10 + ))))); auto FinalBiomes = - std::make_shared> (a_Seed + 1008, - std::make_shared>(a_Seed + 15, - std::make_shared> (a_Seed + 1000, - std::make_shared> (a_Seed + 16, + std::make_shared> (a_Seed + 1, + std::make_shared>(a_Seed + 15, + std::make_shared> (a_Seed + 1, + std::make_shared> (a_Seed + 16, std::make_shared> ( - std::make_shared> (a_Seed + 1002, - std::make_shared>(a_Seed + 1, - std::make_shared> (a_Seed + 1002, - std::make_shared> (a_Seed + 2, + std::make_shared> (a_Seed + 1, std::make_shared> (a_Seed + 2004, 10, - std::make_shared> (a_Seed + 4, - std::make_shared> (a_Seed + 9, 10, biMushroomIsland, - std::make_shared> (biIcePlains, biIcePlainsSpikes, 5, a_Seed + 99, - std::make_shared> (a_Seed + 8, - std::make_shared> (a_Seed + 10, 500, biDeepOcean, - std::make_shared> (a_Seed + 3000, - std::make_shared> (a_Seed + 5, - std::make_shared> ( - std::make_shared> (a_Seed + 1003, - std::make_shared> (a_Seed + 7, + std::make_shared> (a_Seed + 10, 500, biDeepOcean, + std::make_shared> (a_Seed + 1, biPlains, biSunflowerPlains, 20, + std::make_shared> (a_Seed + 5, alteration2, + std::make_shared> (a_Seed + 1, alteration, + std::make_shared> (a_Seed + 3, + std::make_shared>(a_Seed + 2, + std::make_shared> (a_Seed + 4, + std::make_shared> (a_Seed + 99, biIcePlains, biIcePlainsSpikes, 50, + std::make_shared> (a_Seed + 8, + std::make_shared> (a_Seed + 10, 300, biDeepOcean, + std::make_shared> (a_Seed + 9, 8, biMushroomIsland, + std::make_shared> (a_Seed + 3000, + std::make_shared> (a_Seed + 2000, 200, + std::make_shared> (a_Seed + 5, + std::make_shared> (a_Seed + 5, 50, + std::make_shared> ( + std::make_shared> (a_Seed + 2000, 200, + std::make_shared> (a_Seed + 7, std::make_shared> (a_Seed + 8, 50, bgOcean, - std::make_shared> (bgIce, bgTemperate, 50, a_Seed + 101, - std::make_shared> (a_Seed + 2000, 70, + std::make_shared> (a_Seed + 101, bgIce, bgTemperate, 150, + std::make_shared> (a_Seed + 2000, 200, std::make_shared> (a_Seed + 9, 50, bgOcean, - std::make_shared> (a_Seed + 1004, - std::make_shared> (a_Seed + 10, - std::make_shared> (a_Seed + 100, 65 - ))))))))))))))))))))))))))); + std::make_shared> (a_Seed + 10, + std::make_shared> (a_Seed + 100, 30 + ))))))))))))))))))))))))))))))); m_Gen = std::make_shared>(a_Seed, std::make_shared>(a_Seed, - std::make_shared>(a_Seed, - std::make_shared>(a_Seed, - std::make_shared>(a_Seed, - std::make_shared> ( + std::make_shared>(a_Seed, + std::make_shared>(a_Seed, + std::make_shared> ( FinalBiomes, FinalRivers - )))))); + ))))); } virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override @@ -1025,7 +1043,7 @@ public: std::make_shared(a_Seed + 5, std::make_shared(a_Seed + 10, std::make_shared(a_Seed + 5, - std::make_shared(a_Seed + 5, + std::make_shared(a_Seed + 6, std::make_shared(a_Seed + 11, std::make_shared(a_Seed + 12, 2 )))))))))))))); -- cgit v1.2.3 From f5c4a6a27d7c35afbbb57e0798d1473e2795ca22 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 3 Nov 2014 10:36:12 +0100 Subject: Added a (disabled) perf test for biome generators. --- src/Generating/BioGen.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 0f2b0a73d..5480d8d4c 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -5,6 +5,8 @@ #include "Globals.h" #include "BioGen.h" +#include +#include #include "IntGen.h" #include "ProtIntGen.h" #include "../IniFile.h" @@ -1199,3 +1201,47 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool & + +//////////////////////////////////////////////////////////////////////////////// +// Performance tests: + +// Change to 1 to enable the perf test: +#if 0 + +class cBioGenPerfTest +{ +public: + cBioGenPerfTest() + { + std::cout << "BioGen performance tests commencing, please wait..." << std::endl; + TestGen("MultiStepMap", std::make_unique(1).get()); + TestGen("Grown", std::make_unique(1).get()); + TestGen("GrownProt", std::make_unique(1).get()); + std::cout << "BioGen performance tests complete." << std::endl; + } + +protected: + void TestGen(const AString && a_GenName, cBiomeGen * a_BioGen) + { + // Initialize the default settings for the generator: + cIniFile iniFile; + a_BioGen->InitializeBiomeGen(iniFile); + + // Generate the biomes: + auto start = std::chrono::system_clock::now(); + for (int z = 0; z < 100; z++) + { + for (int x = 0; x < 100; x++) + { + cChunkDef::BiomeMap biomes; + a_BioGen->GenBiomes(x, z, biomes); + } // for x + } // for z + auto dur = std::chrono::system_clock::now() - start; + double milliseconds = static_cast((std::chrono::duration_cast(dur)).count()); + + std::cout << a_GenName << ": " << 1000.0 * 100.0 * 100.0 / milliseconds << " chunks per second" << std::endl; + } +} g_BioGenPerfTest; + +#endif \ No newline at end of file -- cgit v1.2.3 From c5f3663bea6e24226217fe91402704a04f118831 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 3 Nov 2014 11:48:03 +0100 Subject: Fixed a missing endline. --- src/Generating/BioGen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Generating/BioGen.cpp') diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 5480d8d4c..2a4dbe794 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -1244,4 +1244,8 @@ protected: } } g_BioGenPerfTest; -#endif \ No newline at end of file +#endif + + + + -- cgit v1.2.3