Changeset 277
- Timestamp:
- Mar 20, 2011, 5:12:24 PM (14 years ago)
- Location:
- experimental/TerrainTest
- Files:
-
- 5 added
- 6 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 -
experimental/TerrainTest/ModificationManager.h
r275 r277 25 25 26 26 27 28 namespace osgTerrain { 27 29 28 30 … … 73 75 //bool removeRoi(region modificationROI); 74 76 77 78 79 /** 80 * \brief This functions sets the geometryTechniqueProtoype. The geometryTechnique is responsible for creating a renderable mesh from the tile data. 81 * 82 * If you want to use a geometryTechnique different from the standard one, you have to use this function. 83 * 84 * @param geomTechnique : GeometryTechnique you want to use for the specified terrain. 85 * @param terrain : Terrain you want to set it's geometryTechniquePrototype. If NULL, the geometrytechnique will be applied to all terrains. 86 */ 75 87 void setGeometryTechniquePrototype( osgTerrain::GeometryTechnique* geomTechnique, osgTerrain::Terrain* terrain=NULL ); 88 89 /** 90 * \brief This function sets the terrainModificationTechnique. 91 * 92 * The terrainModificationTechnique can modify the tile data before the data is used by the geometryTechnique to create the renderable mesh. 93 * 94 * @param terrainModTechnique 95 * @param terrain 96 */ 97 void setTerrainModificationTechnique( osgTerrain::GeometryTechnique* terrainModTechnique, osgTerrain::Terrain* terrain=NULL ); 76 98 77 99 … … 87 109 88 110 }; 111 112 } // Namespace end. -
experimental/TerrainTest/TerrainTest.sln
r274 r277 1165 1165 EndProject 1166 1166 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Terrain Modification", "Terrain Modification", "{805F6302-F552-4A31-8AB3-02EEBEE17C32}" 1167 EndProject 1168 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ModificationManager", "ModificationManager\ModificationManager.vcproj", "{C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}" 1167 1169 EndProject 1168 1170 Global … … 2524 2526 {F495149B-D575-4E9F-B7A0-F4BC82C25945}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32 2525 2527 {F495149B-D575-4E9F-B7A0-F4BC82C25945}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|Win32 2528 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.Debug|Win32.ActiveCfg = Debug|Win32 2529 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.Debug|Win32.Build.0 = Debug|Win32 2530 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.Debug|x64.ActiveCfg = Debug|Win32 2531 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.MinSizeRel|Win32.ActiveCfg = Release|Win32 2532 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.MinSizeRel|Win32.Build.0 = Release|Win32 2533 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.MinSizeRel|x64.ActiveCfg = Release|Win32 2534 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.Release|Win32.ActiveCfg = Release|Win32 2535 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.Release|Win32.Build.0 = Release|Win32 2536 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.Release|x64.ActiveCfg = Release|Win32 2537 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32 2538 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.RelWithDebInfo|Win32.Build.0 = Release|Win32 2539 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}.RelWithDebInfo|x64.ActiveCfg = Release|Win32 2526 2540 EndGlobalSection 2527 2541 GlobalSection(SolutionProperties) = preSolution … … 2529 2543 EndGlobalSection 2530 2544 GlobalSection(NestedProjects) = preSolution 2545 {59A20266-19E6-4ABD-A43A-6485BA7C1537} = {805F6302-F552-4A31-8AB3-02EEBEE17C32} 2546 {31EA52E8-FAAA-4B5E-BC40-4E4E7050E5F1} = {805F6302-F552-4A31-8AB3-02EEBEE17C32} 2547 {C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58} = {805F6302-F552-4A31-8AB3-02EEBEE17C32} 2531 2548 {834311F5-F14B-488D-A1F3-1690916382BC} = {B5054884-F605-4747-8FBE-0279E25559E6} 2532 2549 {77FC9035-6034-40B5-A7C4-ADA3480AAE93} = {B5054884-F605-4747-8FBE-0279E25559E6} … … 2637 2654 {2094AEB9-51C2-4BE8-AE77-ECFADAFC753E} = {A94F2911-F2EE-4766-932E-2C517D262916} 2638 2655 {EF8EE8C4-C778-4523-A6C2-BADEFD105751} = {A94F2911-F2EE-4766-932E-2C517D262916} 2639 {59A20266-19E6-4ABD-A43A-6485BA7C1537} = {805F6302-F552-4A31-8AB3-02EEBEE17C32}2640 {31EA52E8-FAAA-4B5E-BC40-4E4E7050E5F1} = {805F6302-F552-4A31-8AB3-02EEBEE17C32}2641 2656 EndGlobalSection 2642 2657 EndGlobal -
experimental/TerrainTest/myTerrainTechnique.cpp
r275 r277 32 32 h->setHeight( 0,0, 1000); 33 33 34 //OpenThreads::Thread::microSleep( 50000 ); / To simulate some complex tile modification. 35 34 36 /* 35 37 ImageLayer* il = dynamic_cast<ImageLayer*>( getTerrainTile()->getColorLayer(0) ); … … 46 48 47 49 GeometryTechnique::init(dirtyMask, assumeMultiThreaded); 48 49 //OpenThreads::Thread::microSleep( 50000 ); / To simulate some complex tile modification.50 50 } -
experimental/TerrainTest/myTileLoadedCallback.h
r276 r277 18 18 * \brief This function must be implemented. 19 19 * 20 * @return : Extrnal layer lo ding status.20 * @return : Extrnal layer loading status. 21 21 */ 22 22 virtual bool deferExternalLayerLoading() const {return true;} … … 28 28 * 29 29 * @param tile : Loaded tile. 30 * @param options : Reader writer opti ns. Defined as interface, but in this classnot used.30 * @param options : Reader writer options. Defined in the base class, but here not used. 31 31 */ 32 32 virtual void loaded(osgTerrain::TerrainTile* tile, const osgDB::ReaderWriter::Options* options) const {tile->setTerrainTechnique( new T() );}; -
experimental/TerrainTest/osgterrain.cpp
r276 r277 215 215 } 216 216 217 //osgDB::DatabasePager::create()->setDoPreCompile(true);218 219 217 osgTerrain::Terrain* terrain = findTopMostNodeOfType<osgTerrain::Terrain>(rootnode); 220 218 if (!terrain)
Note: See TracChangeset
for help on using the changeset viewer.