2009-01-14 23:16:29 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
|
2008-09-21 19:05:03 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSGVOLUME
|
|
|
|
#define OSGVOLUME 1
|
|
|
|
|
|
|
|
#include <osg/Group>
|
|
|
|
#include <osg/CoordinateSystemNode>
|
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
#include <osgVolume/VolumeTile>
|
2008-09-21 19:05:03 +08:00
|
|
|
|
|
|
|
namespace osgVolume {
|
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
/** Volume provides a framework for loosely coupling 3d image VolumeTile's with volume algorithms.
|
2008-09-21 19:05:03 +08:00
|
|
|
* This allows VolumeTechnique's to be plugged in at runtime.*/
|
|
|
|
class OSGVOLUME_EXPORT Volume : public osg::Group
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
Volume();
|
|
|
|
|
|
|
|
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
|
|
|
Volume(const Volume&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
META_Node(osgVolume, Volume);
|
|
|
|
|
|
|
|
virtual void traverse(osg::NodeVisitor& nv);
|
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
/** Get the VolumeTile for a given VolumeTileID.*/
|
|
|
|
VolumeTile* getVolumeTile(const TileID& tileID);
|
2008-09-21 19:05:03 +08:00
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
/** Get the const VolumeTile for a given VolumeTileID.*/
|
|
|
|
const VolumeTile* getVolumeTile(const TileID& tileID) const;
|
2009-01-15 04:43:21 +08:00
|
|
|
|
2008-09-21 19:05:03 +08:00
|
|
|
|
2009-01-15 04:43:21 +08:00
|
|
|
/** Set the VolumeTechnique prototype that nested VolumeTile should clone if they haven't already been assigned a volume rendering technique. */
|
|
|
|
void setVolumeTechniquePrototype(VolumeTechnique* volumeTechnique) { _volumeTechnique = volumeTechnique; }
|
2009-01-15 04:38:12 +08:00
|
|
|
|
2009-01-15 04:43:21 +08:00
|
|
|
/** Get the VolumeTechnique prototype. */
|
|
|
|
VolumeTechnique* getVolumeTechniquePrototype() { return _volumeTechnique.get(); }
|
2009-01-15 04:38:12 +08:00
|
|
|
|
2009-01-15 04:43:21 +08:00
|
|
|
/** Get the const VolumeTechnique prototype. */
|
|
|
|
const VolumeTechnique* getVolumeTechniquePrototype() const { return _volumeTechnique.get(); }
|
2009-01-15 04:38:12 +08:00
|
|
|
|
|
|
|
|
2008-09-21 19:05:03 +08:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~Volume();
|
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
friend class VolumeTile;
|
2008-09-21 19:05:03 +08:00
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
void dirtyRegisteredVolumeTiles();
|
2008-09-21 19:05:03 +08:00
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
void registerVolumeTile(VolumeTile* tile);
|
|
|
|
void unregisterVolumeTile(VolumeTile* tile);
|
2008-09-21 19:05:03 +08:00
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
typedef std::map< TileID, VolumeTile* > VolumeTileMap;
|
|
|
|
typedef std::set< VolumeTile* > VolumeTileSet;
|
2008-09-21 19:05:03 +08:00
|
|
|
|
2008-12-21 04:55:21 +08:00
|
|
|
mutable OpenThreads::Mutex _mutex;
|
|
|
|
VolumeTileSet _volumeTileSet;
|
|
|
|
VolumeTileMap _volumeTileMap;
|
2008-09-21 19:05:03 +08:00
|
|
|
|
2009-01-15 04:38:12 +08:00
|
|
|
osg::ref_ptr<VolumeTechnique> _volumeTechnique;
|
2008-09-21 19:05:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|