/* -*-c++-*- */ /* osgEarth - Geospatial SDK for OpenSceneGraph * Copyright 2020 Pelican Mapping * http://osgearth.org * * osgEarth is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see */ #ifndef OSGEARTH_DRIVER_DETAIL_OPTIONS #define OSGEARTH_DRIVER_DETAIL_OPTIONS 1 #include #include namespace osgEarth { namespace Detail { using namespace osgEarth; class DetailOptions : public DriverConfigOptions // NO EXPORT; header only { public: // The lod that the detail texture is displayed at. optional& lod() { return _lod; } const optional& size() const { return _lod; } // detail texture. optional& imageURI() { return _imageURI; } const optional& imageURI() const { return _imageURI; } // The alpha of the detail texture. optional& alpha() { return _alpha; } const optional& alpha() const { return _alpha; } // The max range of the detail texture. optional& maxRange() { return _maxRange; } const optional& maxRange() const { return _maxRange; } // The attenutation distance of the detail texture. optional& attenDist() { return _attenDist; } const optional& attenDist() const { return _attenDist; } public: DetailOptions( const ConfigOptions& opt =ConfigOptions() ) : DriverConfigOptions( opt ) { setDriver( "detail" ); _lod.init( 23u ); _alpha.init( 0.5 ); _maxRange.init(6000.0); _attenDist.init(2000.0f); fromConfig( _conf ); } virtual ~DetailOptions() { } public: Config getConfig() const { Config conf = DriverConfigOptions::getConfig(); conf.set("image", _imageURI); conf.set("lod", _lod); conf.set("alpha", _alpha); conf.set("max_range", _maxRange); conf.set("attenuation", _attenDist); return conf; } protected: void mergeConfig( const Config& conf ) { DriverConfigOptions::mergeConfig( conf ); fromConfig( conf ); } private: void fromConfig( const Config& conf ) { conf.get( "image", _imageURI ); conf.get( "lod", _lod ); conf.get( "alpha", _alpha ); conf.get( "max_range", _maxRange ); conf.get( "attenuation", _attenDist); } optional _imageURI; optional _lod; optional _alpha; optional _maxRange; optional _attenDist; }; } } // namespace osgEarth::Detail #endif // OSGEARTH_DRIVER_DETAIL_OPTIONS