1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
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.
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.
18#include <osg/CoordinateSystemNode>
20#include <osgVolume/VolumeTile>
24/** Volume provides a framework for loosely coupling 3d image VolumeTile's with volume algorithms.
25 * This allows VolumeTechnique's to be plugged in at runtime.*/
26class OSGVOLUME_EXPORT Volume : public osg::Group
32 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
33 Volume(const Volume&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
35 META_Node(osgVolume, Volume);
37 virtual void traverse(osg::NodeVisitor& nv);
39 /** Get the VolumeTile for a given VolumeTileID.*/
40 VolumeTile* getVolumeTile(const TileID& tileID);
42 /** Get the const VolumeTile for a given VolumeTileID.*/
43 const VolumeTile* getVolumeTile(const TileID& tileID) const;
46 /** Set the VolumeTechnique prototype that nested VolumeTile should clone if they haven't already been assigned a volume rendering technique. */
47 void setVolumeTechniquePrototype(VolumeTechnique* volumeTechnique) { _volumeTechnique = volumeTechnique; }
49 /** Get the VolumeTechnique prototype. */
50 VolumeTechnique* getVolumeTechniquePrototype() { return _volumeTechnique.get(); }
52 /** Get the const VolumeTechnique prototype. */
53 const VolumeTechnique* getVolumeTechniquePrototype() const { return _volumeTechnique.get(); }
60 friend class VolumeTile;
62 void dirtyRegisteredVolumeTiles();
64 void registerVolumeTile(VolumeTile* tile);
65 void unregisterVolumeTile(VolumeTile* tile);
67 typedef std::map< TileID, VolumeTile* > VolumeTileMap;
68 typedef std::set< VolumeTile* > VolumeTileSet;
70 mutable OpenThreads::Mutex _mutex;
71 VolumeTileSet _volumeTileSet;
72 VolumeTileMap _volumeTileMap;
74 osg::ref_ptr<VolumeTechnique> _volumeTechnique;