[80a6a52] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | #include <limits>
|
---|
| 4 |
|
---|
| 5 | #include <mars_util.h>
|
---|
| 6 | #include <mars_grids.h>
|
---|
| 7 |
|
---|
| 8 | #include "gwutil.h"
|
---|
| 9 | #include "gmregistry.h"
|
---|
| 10 | #include "geomorph.h"
|
---|
| 11 | #include "linalgadapt.h"
|
---|
| 12 | #include "gwtypes.h"
|
---|
| 13 |
|
---|
| 14 | namespace geoworld
|
---|
| 15 | {
|
---|
| 16 | class MountainGM : public HeightMapGeoMorph, public BoundedGeoMorph, public PersistentGeoMorph
|
---|
| 17 | {
|
---|
| 18 | public:
|
---|
| 19 | typedef std::vector < VectorTag< float >::V3 > SeedList;
|
---|
| 20 |
|
---|
| 21 | class MtnState : public PersistentGeoMorph::State
|
---|
| 22 | {
|
---|
| 23 | public:
|
---|
| 24 | SeedList seeds;
|
---|
| 25 | unsigned short nNumMountains;
|
---|
| 26 | float fSeedObedience, fSeedIterations, fRotateThreshold, fPeakHeightFluxPct, fCoarseness, fFalloff, fClumpMaxDisplace;
|
---|
| 27 | unsigned short nMntRangeWidth, nMntRangeAvgHeight;
|
---|
| 28 | GWSurfacePos ptOrigin;
|
---|
| 29 | mars::RangeX< unsigned short > mmnClumpSize;
|
---|
| 30 | mars::BBox< long > bbox;
|
---|
| 31 |
|
---|
| 32 | virtual mars::ObjectStream & operator >> (mars::ObjectStream & outs) const;
|
---|
| 33 | virtual mars::ObjectStream & operator << (mars::ObjectStream & ins);
|
---|
| 34 | };
|
---|
| 35 |
|
---|
| 36 | MountainGM (const MtnState & state);
|
---|
| 37 | MountainGM (
|
---|
| 38 | const GWSurfacePos & ptOrigin,
|
---|
| 39 | const float fSeedObedience,
|
---|
| 40 | const float fSeedIterations,
|
---|
| 41 | const unsigned short nMntRangeWidth,
|
---|
| 42 | const unsigned short nMntRangeAvgHeight,
|
---|
| 43 | const mars::RangeX< unsigned short > mmnClumpSize,
|
---|
| 44 | const float fClumpMaxDisplace,
|
---|
| 45 | const unsigned short nNumMountains,
|
---|
| 46 | const float fRotateThreshold,
|
---|
| 47 | const float frPeakHeightFlux,
|
---|
| 48 | const float frCoarseness,
|
---|
| 49 | const float fFalloff
|
---|
| 50 | );
|
---|
| 51 |
|
---|
| 52 | virtual void init (SynthesisSession & manager, const IGeoWorldAccessor & accessor, const unsigned short nMaxWidth, const unsigned short nMaxHeight);
|
---|
| 53 | virtual mars::BBox< long > getBBox () const { return _bbox; }
|
---|
| 54 | virtual void doMorph (LockedGWSection & section) const;
|
---|
| 55 | virtual mars::ptr< State > createState () const;
|
---|
| 56 |
|
---|
| 57 | private:
|
---|
| 58 | SeedList _seeds;
|
---|
| 59 | unsigned short _nNumMountains;
|
---|
| 60 | float _fSeedObedience, _fSeedIterations, _fRotateThreshold, _fPeakHeightFluxPct, _fCoarseness, _fFalloff, _fClumpMaxDisplace;
|
---|
| 61 | unsigned short _nMntRangeWidth, _nMntRangeAvgHeight;
|
---|
| 62 | GWSurfacePos _ptOrigin;
|
---|
| 63 | mars::RangeX< unsigned short > _mmnClumpSize;
|
---|
| 64 | mars::BBox< long > _bbox;
|
---|
| 65 | };
|
---|
| 66 |
|
---|
| 67 | class MountainGMFactory : public GeoMorphFactory, public IPersistentGeoMorphFactory, public ISurfaceBoundedGeoMorphFactory
|
---|
| 68 | {
|
---|
| 69 | private:
|
---|
| 70 | mars::RangeX< unsigned short >
|
---|
| 71 | _mmnNumMountains,
|
---|
| 72 | _mmnClumpSize,
|
---|
| 73 | _mmnRangeWidth,
|
---|
| 74 | _mmnPeakAvgHeight;
|
---|
| 75 |
|
---|
| 76 | mars::RangeX< float >
|
---|
| 77 | _mmfRotateThreshold,
|
---|
| 78 | _mmfSeedIterations;
|
---|
| 79 |
|
---|
| 80 | float
|
---|
| 81 | _fSeedObedience,
|
---|
| 82 | _frPeakHeightFlux,
|
---|
| 83 | _fCoarseness,
|
---|
| 84 | _fFalloff,
|
---|
| 85 | _fClumpMaxDisplace;
|
---|
| 86 |
|
---|
| 87 | public:
|
---|
| 88 | virtual GeoMorph * createRandomInstance(const long x, const long y) const;
|
---|
| 89 | virtual void configure( IConfigGMFactory * pFactoryConfig, const IConfigGMFactory::Settings & settings );
|
---|
| 90 | virtual void save (const GeoMorph * pGM, mars::ObjectStream & outs) const;
|
---|
| 91 | virtual const GeoMorph * restore (mars::ObjectStream & ins) const;
|
---|
| 92 | };
|
---|
| 93 | } |
---|