#include "rough.h" #include namespace geoworld { void RoughGM::doMorph( LockedGWSection & section ) const { section += *_ngen.compute(section.getActualWidth(), section.getActualHeight()); } GeoMorph * RoughGTFactory::createRandomInstance() const { return new RoughGM( _mmfCoarseness.next(), _mmfBrownIterations.next() ); } void RoughGTFactory::configure( IConfigGTFactory * pFactoryConfig, const IConfigGTFactory::Settings & settings ) { const geoworld::IConfigSection & section = *pFactoryConfig->getSection(); *section["coarseness"] >> _mmfCoarseness; *section["roughness"] >> _mmfBrownIterations; if (_mmfCoarseness.minimum < 0 || _mmfCoarseness.maximum > 1.0) throw GMInvalidPropertyEx("coarseness", "Coarseness must be between zero and one"); if (_mmfBrownIterations.minimum < 0 || _mmfBrownIterations.maximum > 1.0) throw GMInvalidPropertyEx("roughness", "Roughness must be between zero and one"); } }