source: Revenant/geoworld/include/oregen.h@ 7ef8ec4

port/mars-tycoon
Last change on this file since 7ef8ec4 was 80a6a52, checked in by Jonathan Neufeld <support@…>, 3 years ago

Get to a compile state for terrain procedural generation

  • Property mode set to 100644
File size: 2.2 KB
Line 
1#ifndef __OREGENESIS_H__
2#define __OREGENESIS_H__
3
4#include <mars_lookup.h>
5
6#include "gwtypes.h"
7#include "mindb.h"
8#include "stratum.h"
9#include "geometry.h"
10#include "worldfile.h"
11#include "gwconfig.h"
12
13namespace geoworld
14{
15 class OreInstance
16 {
17 public:
18 MineralDeposit deposit;
19 size_t pass;
20
21 OreInstance (const mars::ptr< MineralDef > & pMin, const size_t pass, const DepositDistribution enddDepositDistribution)
22 : deposit(pMin, enddDepositDistribution), pass(pass) {}
23 };
24 typedef mars::OctTree_SphereIndexed< OreInstance, GeoSpherePack::SCALAR > OctTreeOreInstance;
25
26 class DepositSynthesizer : public IMineralQuery
27 {
28 public:
29 static const float FREQUENCY_MULTIPLIER;
30
31 DepositSynthesizer(const MineralsDB * pMinDB, const DepositSynthesizerSettings & settings, const WorldUnit nWidth, const WorldUnit nHeight, const WorldUnit nDepth, const unsigned short nDEMLOD);
32 ~DepositSynthesizer();
33
34 static DepositSynthesizerSettings loadSettings (IDepositSynthConfigReader & cfgreader);
35
36 void generateStrata();
37 void generateMinerals(const unsigned int nPass);
38
39 inline const Stratum & getStratum () const { return _stratum; }
40 inline Stratum & getStratum () { return _stratum; }
41 inline const OctTreeOreInstance & getOctTreeMineralDeposits () const { return _otOre; }
42
43 inline void operator >> (FileSource::MineralHostMap & dest) const
44 { dest << _stratum; }
45 inline void operator << (FileSource::MineralHostMap & src)
46 { src >> _stratum; }
47
48 void operator >> (FileSource::MineralMap & dest) const;
49
50 private:
51 typedef SpherePackFactory< OctTreeOreInstance::SCALAR > BubbleGumFactory;
52
53 mars::StaticParabolicScale< PointScale, CountPtSc >
54 _pbsAbundance, _pbsDepositSize;
55 mars::ParabolicScale< size_t >
56 _pbsThickness;
57
58 const MineralsDB * _pMinDB;
59 BubbleGumFactory _factBubbleGum;
60 const unsigned long _nAbsWidth, _nAbsHeight;
61
62 Stratum _stratum;
63
64 OctTreeOreInstance _otOre;
65 DepositSynthesizerSettings _settings;
66
67 std::pair< BubbleGumFactory::PackPtr, DepositDistribution > depositMineral( const PetrogenyDef & petrogeny, const OctTreeOreInstance::VECTOR & ptChosenSpot, const mars::ptr< MineralDef > & pMin, const size_t nPass );
68
69 static Silica selectSilica (const float fRatio);
70 static Origin selectOrigin (const float fRatio);
71 };
72}
73
74#endif
Note: See TracBrowser for help on using the repository browser.