Ignore:
Timestamp:
Mar 20, 2011, 5:12:24 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/TerrainTest/ModificationManager.cpp

    r276 r277  
    1717#include "ModificationManager.h"
    1818
     19// Used geometryTechniques
     20#include "myTerrainTechnique.h"
     21
     22// Used terrainTechniques.
     23//-
     24
    1925#define USE_TERRAIN_PROTO_WORKAROUND USE_TERRAIN_PROTO_WORKAROUND
    2026
     27
     28using namespace osgTerrain;
    2129
    2230void ModificationManager::addTerrainToManage(osgTerrain::Terrain* terrain)
     
    4149void ModificationManager::setGeometryTechniquePrototype( osgTerrain::GeometryTechnique* geomTechnique, osgTerrain::Terrain* terrain )
    4250{
    43         if(!geomTechnique)      // Remove the installed geometry technique
     51        for(unsigned int i=0;i<managedTerrain.size();i++)
    4452        {
    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
    6073}
    6174
Note: See TracChangeset for help on using the changeset viewer.