OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VolumeTile.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 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 OSGVOLUME_tile
15 #define OSGVOLUME_tile 1
16 
17 #include <osg/Group>
18 #include <osg/Image>
19 
20 #include <osgDB/ReaderWriter>
21 
22 #include <osgVolume/Layer>
23 #include <osgVolume/VolumeTechnique>
24 
25 namespace osgVolume {
26 
27 class Volume;
28 
30 {
31  public:
32 
33  TileID();
34 
35  TileID(int in_level, int in_x, int in_y, int in_z);
36 
37  bool operator == (const TileID& rhs) const
38  {
39  return (level==rhs.level) && (x==rhs.x) && (y==rhs.y) && (z==rhs.z);
40  }
41 
42  bool operator != (const TileID& rhs) const
43  {
44  return (level!=rhs.level) || (x!=rhs.x) || (y!=rhs.y) || (z!=rhs.z);
45  }
46 
47  bool operator < (const TileID& rhs) const
48  {
49  if (level<rhs.level) return true;
50  if (level>rhs.level) return false;
51  if (x<rhs.x) return true;
52  if (x>rhs.x) return false;
53  if (y<rhs.y) return true;
54  if (y>rhs.y) return false;
55  return z<rhs.z;
56  }
57 
58  bool valid() const { return level>=0; }
59 
60  int level;
61  int x;
62  int y;
63  int z;
64 };
65 
66 
70 {
71  public:
72 
73  VolumeTile();
74 
77 
79 
80  virtual void traverse(osg::NodeVisitor& nv);
81 
83  void init();
84 
85 
87  void setVolume(Volume* ts);
88 
90  Volume* getVolume() { return _volume; }
91 
93  const Volume* getVolume() const { return _volume; }
94 
95 
99  void setTileID(const TileID& tileID);
100 
102  const TileID& getTileID() const { return _tileID; }
103 
104 
105  void setLocator(Locator* locator) { _locator = locator; }
106  Locator* getLocator() { return _locator.get(); }
107  const Locator* getLocator() const { return _locator.get(); }
108 
109 
110  void setLayer(Layer* layer);
111  Layer* getLayer() { return _layer.get(); }
112  const Layer* getLayer() const { return _layer.get(); }
113 
114 
115 
117  void setVolumeTechnique(VolumeTechnique* VolumeTechnique);
118 
120  VolumeTechnique* getVolumeTechnique() { return _volumeTechnique.get(); }
121 
123  const VolumeTechnique* getVolumeTechnique() const { return _volumeTechnique.get(); }
124 
125 
127  void setDirty(bool dirty);
128 
130  bool getDirty() const { return _dirty; }
131 
132 
133  virtual osg::BoundingSphere computeBound() const;
134 
135  protected:
136 
137  virtual ~VolumeTile();
138 
139  friend class Volume;
140 
142 
143  bool _dirty;
145 
147 
149 
151 
153 };
154 
155 }
156 
157 #endif
VolumeTechnique * getVolumeTechnique()
Definition: VolumeTile.h:120
osg::ref_ptr< VolumeTechnique > _volumeTechnique
Definition: VolumeTile.h:148
osg::ref_ptr< Layer > _layer
Definition: VolumeTile.h:152
#define OSGVOLUME_EXPORT
Definition: Export.h:39
#define META_Node(library, name)
Definition: Node.h:59
const Layer * getLayer() const
Definition: VolumeTile.h:112
bool getDirty() const
Definition: VolumeTile.h:130
Volume * getVolume()
Definition: VolumeTile.h:90
const VolumeTechnique * getVolumeTechnique() const
Definition: VolumeTile.h:123
const Locator * getLocator() const
Definition: VolumeTile.h:107
GLint level
Definition: GLU.h:71
const Volume * getVolume() const
Definition: VolumeTile.h:93
osg::ref_ptr< Locator > _locator
Definition: VolumeTile.h:150
Locator * getLocator()
Definition: VolumeTile.h:106
const TileID & getTileID() const
Definition: VolumeTile.h:102
void setLocator(Locator *locator)
Definition: VolumeTile.h:105
bool valid() const
Definition: VolumeTile.h:58