Ignore:
Timestamp:
Mar 20, 2011, 5:12:24 PM (14 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/TerrainTest
Files:
5 added
6 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
  • experimental/TerrainTest/ModificationManager.h

    r275 r277  
    2525
    2626
     27
     28namespace osgTerrain {
    2729
    2830
     
    7375        //bool removeRoi(region modificationROI);
    7476
     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         */
    7587        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 );
    7698
    7799
     
    87109
    88110};
     111
     112}       // Namespace end.
  • experimental/TerrainTest/TerrainTest.sln

    r274 r277  
    11651165EndProject
    11661166Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Terrain Modification", "Terrain Modification", "{805F6302-F552-4A31-8AB3-02EEBEE17C32}"
     1167EndProject
     1168Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ModificationManager", "ModificationManager\ModificationManager.vcproj", "{C6A93F26-EE4F-4B7A-BA20-11D7E34C6F58}"
    11671169EndProject
    11681170Global
     
    25242526                {F495149B-D575-4E9F-B7A0-F4BC82C25945}.RelWithDebInfo|Win32.Build.0 = RelWithDebInfo|Win32
    25252527                {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
    25262540        EndGlobalSection
    25272541        GlobalSection(SolutionProperties) = preSolution
     
    25292543        EndGlobalSection
    25302544        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}
    25312548                {834311F5-F14B-488D-A1F3-1690916382BC} = {B5054884-F605-4747-8FBE-0279E25559E6}
    25322549                {77FC9035-6034-40B5-A7C4-ADA3480AAE93} = {B5054884-F605-4747-8FBE-0279E25559E6}
     
    26372654                {2094AEB9-51C2-4BE8-AE77-ECFADAFC753E} = {A94F2911-F2EE-4766-932E-2C517D262916}
    26382655                {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}
    26412656        EndGlobalSection
    26422657EndGlobal
  • experimental/TerrainTest/myTerrainTechnique.cpp

    r275 r277  
    3232        h->setHeight( 0,0, 1000);
    3333
     34        //OpenThreads::Thread::microSleep( 50000 );     / To simulate some complex tile modification.
     35
    3436         /*
    3537         ImageLayer* il = dynamic_cast<ImageLayer*>( getTerrainTile()->getColorLayer(0) );
     
    4648         
    4749    GeometryTechnique::init(dirtyMask, assumeMultiThreaded);
    48 
    49         //OpenThreads::Thread::microSleep( 50000 );     / To simulate some complex tile modification.
    5050}
  • experimental/TerrainTest/myTileLoadedCallback.h

    r276 r277  
    1818         * \brief This function must be implemented.
    1919         *
    20          * @return : Extrnal layer loding status.
     20         * @return : Extrnal layer loading status.
    2121         */
    2222        virtual bool deferExternalLayerLoading() const {return true;}
     
    2828         *
    2929         * @param tile : Loaded tile.
    30          * @param options : Reader writer optins. Defined as interface, but in this class not used.
     30         * @param options : Reader writer options. Defined in the base class, but here not used.
    3131         */
    3232        virtual void loaded(osgTerrain::TerrainTile* tile, const osgDB::ReaderWriter::Options* options) const {tile->setTerrainTechnique( new T() );};
  • experimental/TerrainTest/osgterrain.cpp

    r276 r277  
    215215    }
    216216
    217         //osgDB::DatabasePager::create()->setDoPreCompile(true);
    218 
    219217    osgTerrain::Terrain* terrain = findTopMostNodeOfType<osgTerrain::Terrain>(rootnode);
    220218    if (!terrain)
Note: See TracChangeset for help on using the changeset viewer.