root/OpenSceneGraph/trunk/include/osgTerrain/TerrainTechnique @ 13041

Revision 13041, 3.2 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGTERRAIN_TERRAINTECHNIQUE
15#define OSGTERRAIN_TERRAINTECHNIQUE 1
16
17#include <osg/Object>
18
19#include <osgUtil/UpdateVisitor>
20#include <osgUtil/CullVisitor>
21
22#include <osgTerrain/Export>
23
24namespace osgTerrain {
25
26class TerrainTile;
27
28class OSGTERRAIN_EXPORT TerrainNeighbours
29{
30    public:
31
32        TerrainNeighbours();
33        ~TerrainNeighbours();
34
35        void clear();
36        void addNeighbour(TerrainTile* tile);
37        void removeNeighbour(TerrainTile* tile);
38        bool containsNeighbour(TerrainTile* tile) const;
39
40    protected:
41
42        TerrainNeighbours(const TerrainNeighbours& /*tn*/) {}
43        TerrainNeighbours& operator = (const TerrainNeighbours& /*rhs*/) { return *this; }
44
45        typedef std::set<TerrainTile*> Neighbours;
46
47        mutable OpenThreads::Mutex      _neighboursMutex;
48        Neighbours                      _neighbours;
49};
50
51
52class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object, public osg::Observer
53{
54    public:
55
56        TerrainTechnique();
57
58        /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
59        TerrainTechnique(const TerrainTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
60
61        META_Object(osgTerrain, TerrainTechnique);
62
63        TerrainTile* getTerrainTile() { return _terrainTile; }
64        const TerrainTile* getTerrainTile() const { return _terrainTile; }
65
66        virtual void init(int dirtyMask, bool assumeMultiThreaded);
67
68        virtual void update(osgUtil::UpdateVisitor* nv);
69
70        virtual void cull(osgUtil::CullVisitor* nv);
71
72        /** Clean scene graph from any terrain technique specific nodes.*/
73        virtual void cleanSceneGraph();
74
75        /** Traverse the terrain subgraph.*/
76        virtual void traverse(osg::NodeVisitor& nv);
77
78        /** If State is non-zero, this function releases any associated OpenGL objects for
79        * the specified graphics context. Otherwise, releases OpenGL objects
80        * for all graphics contexts. */
81        virtual void releaseGLObjects(osg::State* = 0) const {}
82
83        void addNeighbour(TerrainTile* tile) { _neighbours.addNeighbour(tile); }
84        void removeNeighbour(TerrainTile* tile) {  _neighbours.removeNeighbour(tile); }
85        bool containsNeighbour(TerrainTile* tile) { return _neighbours.containsNeighbour(tile); }
86
87    protected:
88
89        virtual ~TerrainTechnique();
90
91        void setTerrainTile(TerrainTile* tile);
92        void setDirty(bool dirty);
93
94        friend class osgTerrain::TerrainTile;
95
96        TerrainTile*            _terrainTile;
97
98
99        TerrainNeighbours       _neighbours;
100
101};
102
103}
104
105#endif
Note: See TracBrowser for help on using the browser.