osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarth/TerrainOptions

Go to the documentation of this file.
00001 /* -*-c++-*- */
00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
00003 * Copyright 2008-2010 Pelican Mapping
00004 * http://osgearth.org
00005 *
00006 * osgEarth is free software; you can redistribute it and/or modify
00007 * it under the terms of the GNU Lesser General Public License as published by
00008 * the Free Software Foundation; either version 2 of the License, or
00009 * (at your option) any later version.
00010 *
00011 * This program is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 * GNU Lesser General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU Lesser General Public License
00017 * along with this program.  If not, see <http://www.gnu.org/licenses/>
00018 */
00019 #ifndef OSGEARTH_TERRAIN_OPTIONS_H
00020 #define OSGEARTH_TERRAIN_OPTIONS_H 1
00021 
00022 #include <osgEarth/Common>
00023 #include <osgEarth/Config>
00024 #include <osgEarth/HeightFieldUtils>
00025 
00026 namespace osgEarth
00027 {
00031     class OSGEARTH_EXPORT LoadingPolicy
00032     {
00033     public:
00035         enum Mode {
00037             MODE_SERIAL,
00038 
00040             MODE_PARALLEL,
00041 
00044             MODE_SEQUENTIAL,
00045 
00048             MODE_PREEMPTIVE,
00049 
00051             MODE_STANDARD = MODE_SERIAL
00052         };
00053 
00054     public:
00055         LoadingPolicy( const Config& conf =Config() );
00056         LoadingPolicy( const Mode& mode );
00057 
00058     public: // Configrable
00059         virtual Config getConfig() const;
00060         virtual void fromConfig( const Config& conf );
00061 
00062     public:
00066         optional<Mode>& mode() { return _mode; }
00067         const optional<Mode>& mode() const { return _mode; }
00068 
00076         optional<float>& numLoadingThreadsPerCore() { return _numLoadingThreadsPerCore; }
00077         const optional<float>& numLoadingThreadsPerCore() const { return _numLoadingThreadsPerCore; }
00078 
00086         const optional<int>& numLoadingThreads() const { return _numLoadingThreads; }
00087         optional<int>& numLoadingThreads() { return _numLoadingThreads; }
00088 
00094         const optional<int>& numCompileThreads() const { return _numCompileThreads; }
00095         optional<int>& numCompileThreads() { return _numCompileThreads; }
00096 
00102         const optional<float>& numCompileThreadsPerCore() const { return _numCompileThreadsPerCore; }
00103         optional<float>& numCompileThreadsPerCore() { return _numCompileThreadsPerCore; }
00104 
00105     protected:
00106         optional<Mode> _mode;
00107         optional<int>   _numLoadingThreads;
00108         optional<float> _numLoadingThreadsPerCore;
00109         optional<int>   _numCompileThreads;
00110         optional<float> _numCompileThreadsPerCore;
00111     };
00112 
00113     extern OSGEARTH_EXPORT int computeLoadingThreads(const LoadingPolicy& policy);
00114     
00118     class OSGEARTH_EXPORT TerrainOptions : public DriverConfigOptions
00119     {
00120     public:
00121         TerrainOptions( const ConfigOptions& options =ConfigOptions() );
00122        
00127         optional<float>& verticalScale() { return _verticalScale; }
00128         const optional<float>& verticalScale() const { return _verticalScale; }
00129 
00135         optional<float>& heightFieldSampleRatio() { return _heightFieldSampleRatio; }
00136         const optional<float>& heightFieldSampleRatio() const { return _heightFieldSampleRatio; }
00137 
00142         optional<float>& minTileRangeFactor() { return _minTileRangeFactor; }
00143         const optional<float>& minTileRangeFactor() const { return _minTileRangeFactor; }
00144 
00149         optional<bool>& normalizeEdges() { return _normalizeEdges; }
00150         const optional<bool>& normalizeEdges() const { return _normalizeEdges; }
00151 
00158         optional<bool>& combineLayers() { return _combineLayers; }
00159         const optional<bool>& combineLayers() const { return _combineLayers; }
00160 
00164         optional<LoadingPolicy>& loadingPolicy() { return _loadingPolicy; }
00165         const optional<LoadingPolicy>& loadingPolicy() const { return _loadingPolicy; }
00166 
00170         optional<float>& attenuationDistance() { return _attenuationDistance; }
00171         const optional<float>& attentuationDistance() const { return _attenuationDistance; }
00172 
00176         optional<float>& lodTransitionTime() { return _lodTransitionTimeSeconds; }
00177         const optional<float>& lodTransitionTime() const { return _lodTransitionTimeSeconds; }
00178 
00182         enum CompositingTechnique
00183         {
00184             COMPOSITING_AUTO,
00185             COMPOSITING_TEXTURE_ARRAY,
00186             COMPOSITING_MULTITEXTURE_GPU,
00187             COMPOSITING_MULTITEXTURE_FFP,
00188             COMPOSITING_MULTIPASS
00189         };
00190 
00194         optional<CompositingTechnique>& compositingTechnique() { return _compositingTech; }
00195         const optional<CompositingTechnique>& compositingTechnique() const { return _compositingTech; }
00196 
00200         optional<int>& maxLOD() { return _maxLOD; }
00201         const optional<int>& maxLOD() const { return _maxLOD; }
00202 
00206         optional<bool>& enableLighting() { return _enableLighting; }
00207         const optional<bool>& enableLighting() const { return _enableLighting; }  
00208     
00212         optional<ElevationInterpolation>& elevationInterpolation(void) { return _elevationInterpolation; }
00213         const optional<ElevationInterpolation>& elevationInterpolation(void) const { return _elevationInterpolation;}
00214 
00218         optional<bool>& enableMipmapping() { return _enableMipmapping; }
00219         const optional<bool>& enableMipmapping() const { return _enableMipmapping; }
00220    
00221     public:
00222         virtual Config getConfig() const;
00223 
00224     protected:
00225         virtual void mergeConfig( const Config& conf ) {
00226             DriverConfigOptions::mergeConfig( conf );
00227             fromConfig( conf );
00228         }
00229 
00230     private:
00231         void fromConfig( const Config& conf );
00232             
00233         optional<float> _verticalScale;
00234         optional<float> _heightFieldSampleRatio;
00235         optional<float> _minTileRangeFactor;
00236         optional<bool> _normalizeEdges;
00237         optional<bool> _combineLayers;
00238         optional<LoadingPolicy> _loadingPolicy;
00239         optional<CompositingTechnique> _compositingTech;
00240         optional<int> _maxLOD;
00241         optional<bool> _enableLighting;
00242         optional<float> _attenuationDistance;
00243         optional<bool> _lodBlending;
00244         optional<float> _lodTransitionTimeSeconds;
00245         optional<bool>  _enableMipmapping;
00246 #if 0
00247         optional<osg::Texture::FilterMode> _contourMagFilter;
00248         optional<osg::Texture::FilterMode> _contourMinFilter;
00249 #endif
00250         optional<ElevationInterpolation> _elevationInterpolation;
00251     };
00252 }
00253 
00254 #endif // OSGEARTH_MAP_ENGINE_PROPERTIES_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines