osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthDrivers/engine_osgterrain/MultiPassTerrainTechnique

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_ENGINE_OSGTERRAIN_MULTIPASS_TERRAIN_TECHNIQUE
00020 #define OSGEARTH_ENGINE_OSGTERRAIN_MULTIPASS_TERRAIN_TECHNIQUE 1
00021 
00022 #include "CustomTerrainTechnique"
00023 #include "TransparentLayer"
00024 
00025 #include <osg/MatrixTransform>
00026 #include <osg/Geode>
00027 #include <osg/Geometry>
00028 #include <osg/Version>
00029 
00030 #include <osgTerrain/TerrainTechnique>
00031 #include <osgTerrain/Locator>
00032 
00033 #include <osgEarth/TextureCompositor>
00034 
00035 
00036 class MultiPassTerrainTechnique : public TerrainTechnique
00037 {
00038 public:
00039 
00040     MultiPassTerrainTechnique( TextureCompositor* texCompositor =0L );
00041 
00043     MultiPassTerrainTechnique(const MultiPassTerrainTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
00044     
00045     META_Object( osgEarth, MultiPassTerrainTechnique );
00046 
00047     virtual void init();
00048     
00049     virtual osgTerrain::Locator* computeMasterLocator();
00050     
00051     virtual osg::Vec3d computeCenterModel(osgTerrain::Locator* masterLocator);
00052     
00053     virtual void generateGeometry(osgTerrain::Locator* masterLocator, const osg::Vec3d& centerModel);     
00054 
00055         virtual osg::Geometry* createGeometryPrototype(osgTerrain::Locator* masterLocator, const osg::Vec3d& centerModel);
00056 
00057         osg::Geode* createPass(unsigned int order, const CustomColorLayer* layer, osgTerrain::Locator* masterLocator, const osg::Vec3d& centerModel, osg::Geometry* geometry); 
00058 
00060     virtual void traverse(osg::NodeVisitor& nv);
00061 
00065     virtual void releaseGLObjects(osg::State* = 0) const;
00066 
00067 
00068 private:
00069 
00070     void updateTransparency();
00071     void updateGeometry();
00072 
00073     virtual ~MultiPassTerrainTechnique();
00074 
00075     osg::ref_ptr<osg::MatrixTransform>  _transform;
00076     osg::ref_ptr<osg::Group>            _passes;            
00077     bool                                _terrainTileInitialized;
00078     osg::ref_ptr<TextureCompositor>     _texCompositor;
00079 };
00080 
00081 #endif //OSGEARTH_ENGINE_OSGTERRAIN_MULTIPASS_TERRAIN_TECHNIQUE
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines