source: experimental/TerrainTest/ModificationManager.h @ 275

Last change on this file since 275 was 275, checked in by Torben Dannhauer, 13 years ago
File size: 3.4 KB
Line 
1#pragma once
2/* -*-c++-*- osgVisual - Copyright (C) 2009-2011 Torben Dannhauer
3 *
4 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version.  The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
10 * You have to aquire licenses for all used proprietary modules.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * OpenSceneGraph Public License for more details.
16*/
17
18#include "region.h"
19#include "myTileLoadedCallback.h"
20#include "terrainModificationTechnique.h"
21#include <osgTerrain/Terrain>
22#include <osgTerrain/GeometryTechnique>
23#include <osg/observer_ptr>
24#include <vector>
25
26
27
28
29/**
30 * \brief This class provides a management interface to control terrain modification.
31 *
32 * It is possible to modify preprocessed VirtualPLanetBuilder (VPB) Databases on the fly.
33 * The modification can be performed in two ways:
34 * a) Modifying only the tile data and using the standard geometryTechnique to mesh the drawable.
35 * b) Using an userdefined geometryTechnique to create other meshes than the regular triangle mesh.
36 *
37 * Currently the changes are made on run time but in the pseudo loader. This way the modification does not affect the frame rate but only the delay in the tile delivery to the rendering thread.
38 *
39 * @author Torben Dannhauer
40 * @date  Mrz 2011
41 */ 
42class ModificationManager
43{
44public:
45        //! Destructor: Must be public to ensure the singleton can be cleand up at the end of the programm.
46        ~ModificationManager(){};
47
48        /**
49         * \brief This function returns a reference to the singleton instance of the terrain manager.
50         *
51         * @return Reference to the singleton instance of the terrain manager.
52         */ 
53        static ModificationManager* getInstance() {static ModificationManager instance; return &instance;}
54
55        /**
56         * \brief This function adds a terrain class to the manager to be managed and accessible to terrain modifications.
57         *
58         * @param terrain : Terrain to manage.
59         */ 
60        void addTerrainToManage(osgTerrain::Terrain* terrain);
61
62        /**
63         * \brief This functions removes a terrain class from the manager to stop it's managing.
64         *
65         * @param terrain : Terrain to remove.
66         * @return : True of the specified terrain was managed and is now removed. If the specified terrain was not managed it will return false.
67         */ 
68        bool removeTerrainToManage(osgTerrain::Terrain* terrain);
69
70
71
72        //void addRoi(region modificationROI, terrainModificationTechnique* technique=NULL);
73        //bool removeRoi(region modificationROI);
74
75        void setGeometryTechniquePrototype( osgTerrain::GeometryTechnique* geomTechnique, osgTerrain::Terrain* terrain=NULL );
76
77
78private:
79        //! Constructor: Private to avoid that this class can be instantiated - it should only be usable as singleton.
80        ModificationManager(){};
81
82        //! Copy-Constructor: Private to avoid that someone can create an class instance by copying the singleton instance.
83        ModificationManager(const ModificationManager& cc) {};
84
85        //! Vector of all managed terrain pointers.
86        std::vector<osgTerrain::Terrain*> managedTerrain;
87
88};
Note: See TracBrowser for help on using the repository browser.