Changeset 277 for experimental/TerrainTest/ModificationManager.cpp
- Timestamp:
- Mar 20, 2011, 5:12:24 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/TerrainTest/ModificationManager.cpp
r276 r277 17 17 #include "ModificationManager.h" 18 18 19 // Used geometryTechniques 20 #include "myTerrainTechnique.h" 21 22 // Used terrainTechniques. 23 //- 24 19 25 #define USE_TERRAIN_PROTO_WORKAROUND USE_TERRAIN_PROTO_WORKAROUND 20 26 27 28 using namespace osgTerrain; 21 29 22 30 void ModificationManager::addTerrainToManage(osgTerrain::Terrain* terrain) … … 41 49 void ModificationManager::setGeometryTechniquePrototype( osgTerrain::GeometryTechnique* geomTechnique, osgTerrain::Terrain* terrain ) 42 50 { 43 if(!geomTechnique) // Remove the installed geometry technique51 for(unsigned int i=0;i<managedTerrain.size();i++) 44 52 { 45 terrain->setTerrainTechniquePrototype( NULL ); 46 #ifdef USE_TERRAIN_PROTO_WORKAROUND 47 osgTerrain::TerrainTile::setTileLoadedCallback(NULL); 48 #endif 49 return; 50 } 51 52 53 terrain->setTerrainTechniquePrototype( geomTechnique ); 54 #ifdef USE_TERRAIN_PROTO_WORKAROUND 55 osg::ref_ptr<osgTerrain::GeometryTechniquePrototypeWorkaroundTLC> tlcb = new osgTerrain::GeometryTechniquePrototypeWorkaroundTLC(); 56 osgTerrain::TerrainTile::setTileLoadedCallback(tlcb); 57 #endif 58 59 53 if(terrain==NULL || terrain==managedTerrain[i]) 54 { 55 if(!geomTechnique) // Remove the installed geometry technique 56 { 57 terrain->setTerrainTechniquePrototype( NULL ); 58 #ifdef USE_TERRAIN_PROTO_WORKAROUND 59 osgTerrain::TerrainTile::setTileLoadedCallback(NULL); 60 #endif 61 } 62 else 63 { 64 terrain->setTerrainTechniquePrototype( geomTechnique ); 65 #ifdef USE_TERRAIN_PROTO_WORKAROUND 66 osg::ref_ptr<osgTerrain::GeometryTechniquePrototypeWorkaroundTLC<osgTerrain::myTerrainTechnique> > tlcb = new osgTerrain::GeometryTechniquePrototypeWorkaroundTLC<osgTerrain::myTerrainTechnique>(); 67 osgTerrain::TerrainTile::setTileLoadedCallback(tlcb); 68 #endif 69 } 70 return; 71 } // IF END 72 } // FOR END 60 73 } 61 74
Note: See TracChangeset
for help on using the changeset viewer.