#pragma once #include #include #include #include "gwutil.h" #include "gmregistry.h" #include "geomorph.h" #include "linalgadapt.h" #include "gwtypes.h" namespace geoworld { class MountainGM : public HeightMapGeoMorph, public BoundedGeoMorph, public PersistentGeoMorph { public: typedef std::vector < VectorTag< float >::V3 > SeedList; class MtnState : public PersistentGeoMorph::State { public: SeedList seeds; unsigned short nNumMountains; float fSeedObedience, fSeedIterations, fRotateThreshold, fPeakHeightFluxPct, fCoarseness, fFalloff, fClumpMaxDisplace; unsigned short nMntRangeWidth, nMntRangeAvgHeight; GWSurfacePos ptOrigin; mars::RangeX< unsigned short > mmnClumpSize; mars::BBox< long > bbox; virtual mars::ObjectStream & operator >> (mars::ObjectStream & outs) const; virtual mars::ObjectStream & operator << (mars::ObjectStream & ins); }; MountainGM (const MtnState & state); MountainGM ( const GWSurfacePos & ptOrigin, const float fSeedObedience, const float fSeedIterations, const unsigned short nMntRangeWidth, const unsigned short nMntRangeAvgHeight, const mars::RangeX< unsigned short > mmnClumpSize, const float fClumpMaxDisplace, const unsigned short nNumMountains, const float fRotateThreshold, const float frPeakHeightFlux, const float frCoarseness, const float fFalloff ); virtual void init (SynthesisSession & manager, const IGeoWorldAccessor & accessor, const unsigned short nMaxWidth, const unsigned short nMaxHeight); virtual mars::BBox< long > getBBox () const { return _bbox; } virtual void doMorph (LockedGWSection & section) const; virtual mars::ptr< State > createState () const; private: SeedList _seeds; unsigned short _nNumMountains; float _fSeedObedience, _fSeedIterations, _fRotateThreshold, _fPeakHeightFluxPct, _fCoarseness, _fFalloff, _fClumpMaxDisplace; unsigned short _nMntRangeWidth, _nMntRangeAvgHeight; GWSurfacePos _ptOrigin; mars::RangeX< unsigned short > _mmnClumpSize; mars::BBox< long > _bbox; }; class MountainGMFactory : public GeoMorphFactory, public IPersistentGeoMorphFactory, public ISurfaceBoundedGeoMorphFactory { private: mars::RangeX< unsigned short > _mmnNumMountains, _mmnClumpSize, _mmnRangeWidth, _mmnPeakAvgHeight; mars::RangeX< float > _mmfRotateThreshold, _mmfSeedIterations; float _fSeedObedience, _frPeakHeightFlux, _fCoarseness, _fFalloff, _fClumpMaxDisplace; public: virtual GeoMorph * createRandomInstance(const long x, const long y) const; virtual void configure( IConfigGMFactory * pFactoryConfig, const IConfigGMFactory::Settings & settings ); virtual void save (const GeoMorph * pGM, mars::ObjectStream & outs) const; virtual const GeoMorph * restore (mars::ObjectStream & ins) const; }; }