Renamed osgVolume::Brick to osgVolume::VolumeTile
This commit is contained in:
@@ -13,7 +13,7 @@ SET(LIB_PUBLIC_HEADERS
|
||||
${HEADER_PATH}/Version
|
||||
${HEADER_PATH}/Volume
|
||||
${HEADER_PATH}/VolumeTechnique
|
||||
${HEADER_PATH}/Brick
|
||||
${HEADER_PATH}/VolumeTile
|
||||
)
|
||||
|
||||
# FIXME: For OS X, need flag for Framework or dylib
|
||||
@@ -22,9 +22,9 @@ ADD_LIBRARY(${LIB_NAME}
|
||||
${LIB_PUBLIC_HEADERS}
|
||||
ImageUtils.cpp
|
||||
Version.cpp
|
||||
Brick.cpp
|
||||
VolumeTechnique.cpp
|
||||
Volume.cpp
|
||||
VolumeTechnique.cpp
|
||||
VolumeTile.cpp
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -30,15 +30,15 @@ Volume::~Volume()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
for(BrickSet::iterator itr = _brickSet.begin();
|
||||
itr != _brickSet.end();
|
||||
for(VolumeTileSet::iterator itr = _volumeTileSet.begin();
|
||||
itr != _volumeTileSet.end();
|
||||
++itr)
|
||||
{
|
||||
const_cast<Brick*>(*itr)->_volume = 0;
|
||||
const_cast<VolumeTile*>(*itr)->_volume = 0;
|
||||
}
|
||||
|
||||
_brickSet.clear();
|
||||
_brickMap.clear();
|
||||
_volumeTileSet.clear();
|
||||
_volumeTileMap.clear();
|
||||
}
|
||||
|
||||
void Volume::traverse(osg::NodeVisitor& nv)
|
||||
@@ -46,69 +46,69 @@ void Volume::traverse(osg::NodeVisitor& nv)
|
||||
Group::traverse(nv);
|
||||
}
|
||||
|
||||
Brick* Volume::getBrick(const BrickID& BrickID)
|
||||
VolumeTile* Volume::getVolumeTile(const TileID& tileID)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
BrickMap::iterator itr = _brickMap.find(BrickID);
|
||||
if (itr != _brickMap.end()) return 0;
|
||||
VolumeTileMap::iterator itr = _volumeTileMap.find(tileID);
|
||||
if (itr != _volumeTileMap.end()) return 0;
|
||||
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
const Brick* Volume::getBrick(const BrickID& BrickID) const
|
||||
const VolumeTile* Volume::getVolumeTile(const TileID& tileID) const
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
BrickMap::const_iterator itr = _brickMap.find(BrickID);
|
||||
if (itr != _brickMap.end()) return 0;
|
||||
VolumeTileMap::const_iterator itr = _volumeTileMap.find(tileID);
|
||||
if (itr != _volumeTileMap.end()) return 0;
|
||||
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
void Volume::dirtyRegisteredBricks()
|
||||
void Volume::dirtyRegisteredVolumeTiles()
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
for(BrickSet::iterator itr = _brickSet.begin();
|
||||
itr != _brickSet.end();
|
||||
for(VolumeTileSet::iterator itr = _volumeTileSet.begin();
|
||||
itr != _volumeTileSet.end();
|
||||
++itr)
|
||||
{
|
||||
(const_cast<Brick*>(*itr))->setDirty(true);
|
||||
(const_cast<VolumeTile*>(*itr))->setDirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int s_maxNumBricks = 0;
|
||||
void Volume::registerBrick(Brick* Brick)
|
||||
static unsigned int s_maxNumVolumeTiles = 0;
|
||||
void Volume::registerVolumeTile(VolumeTile* volumeTile)
|
||||
{
|
||||
if (!Brick) return;
|
||||
if (!volumeTile) return;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
if (Brick->getBrickID().valid())
|
||||
if (volumeTile->getTileID().valid())
|
||||
{
|
||||
_brickMap[Brick->getBrickID()] = Brick;
|
||||
_volumeTileMap[volumeTile->getTileID()] = volumeTile;
|
||||
}
|
||||
|
||||
_brickSet.insert(Brick);
|
||||
_volumeTileSet.insert(volumeTile);
|
||||
|
||||
if (_brickSet.size() > s_maxNumBricks) s_maxNumBricks = _brickSet.size();
|
||||
if (_volumeTileSet.size() > s_maxNumVolumeTiles) s_maxNumVolumeTiles = _volumeTileSet.size();
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"Volume::registerBrick "<<Brick<<" total number of Brick "<<_brickSet.size()<<" max = "<<s_maxNumBricks<<std::endl;
|
||||
// osg::notify(osg::NOTICE)<<"Volume::registerVolumeTile "<<volumeTile<<" total number of VolumeTile "<<_volumeTileSet.size()<<" max = "<<s_maxNumVolumeTiles<<std::endl;
|
||||
}
|
||||
|
||||
void Volume::unregisterBrick(Brick* Brick)
|
||||
void Volume::unregisterVolumeTile(VolumeTile* volumeTile)
|
||||
{
|
||||
if (!Brick) return;
|
||||
if (!volumeTile) return;
|
||||
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
|
||||
|
||||
if (Brick->getBrickID().valid())
|
||||
if (volumeTile->getTileID().valid())
|
||||
{
|
||||
_brickMap.erase(Brick->getBrickID());
|
||||
_volumeTileMap.erase(volumeTile->getTileID());
|
||||
}
|
||||
|
||||
_brickSet.erase(Brick);
|
||||
_volumeTileSet.erase(volumeTile);
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"Volume::unregisterBrick "<<Brick<<" total number of Brick "<<_brickSet.size()<<" max = "<<s_maxNumBricks<<std::endl;
|
||||
// osg::notify(osg::NOTICE)<<"Volume::unregisterVolumeTile "<<volumeTile<<" total number of VolumeTile "<<_volumeTileSet.size()<<" max = "<<s_maxNumVolumeTiles<<std::endl;
|
||||
}
|
||||
|
||||
@@ -12,19 +12,19 @@
|
||||
*/
|
||||
|
||||
#include <osgVolume/VolumeTechnique>
|
||||
#include <osgVolume/Brick>
|
||||
#include <osgVolume/VolumeTile>
|
||||
|
||||
using namespace osgVolume;
|
||||
|
||||
VolumeTechnique::VolumeTechnique():
|
||||
_brick(0)
|
||||
_volumeTile(0)
|
||||
{
|
||||
setThreadSafeRefUnref(true);
|
||||
}
|
||||
|
||||
VolumeTechnique::VolumeTechnique(const VolumeTechnique& rhs,const osg::CopyOp& copyop):
|
||||
osg::Object(rhs,copyop),
|
||||
_brick(0)
|
||||
_volumeTile(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -40,13 +40,13 @@ void VolumeTechnique::init()
|
||||
void VolumeTechnique::update(osgUtil::UpdateVisitor* uv)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<className()<<"::update(..) not implementated yet"<<std::endl;
|
||||
if (_brick) _brick->osg::Group::traverse(*uv);
|
||||
if (_volumeTile) _volumeTile->osg::Group::traverse(*uv);
|
||||
}
|
||||
|
||||
void VolumeTechnique::cull(osgUtil::CullVisitor* cv)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<className()<<"::cull(..) not implementated yet"<<std::endl;
|
||||
if (_brick) _brick->osg::Group::traverse(*cv);
|
||||
if (_volumeTile) _volumeTile->osg::Group::traverse(*cv);
|
||||
}
|
||||
|
||||
void VolumeTechnique::cleanSceneGraph()
|
||||
@@ -56,12 +56,12 @@ void VolumeTechnique::cleanSceneGraph()
|
||||
|
||||
void VolumeTechnique::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
if (!_brick) return;
|
||||
if (!_volumeTile) return;
|
||||
|
||||
// if app traversal update the frame count.
|
||||
if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
|
||||
{
|
||||
if (_brick->getDirty()) _brick->init();
|
||||
if (_volumeTile->getDirty()) _volumeTile->init();
|
||||
|
||||
osgUtil::UpdateVisitor* uv = dynamic_cast<osgUtil::UpdateVisitor*>(&nv);
|
||||
if (uv)
|
||||
@@ -81,8 +81,8 @@ void VolumeTechnique::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
}
|
||||
|
||||
if (_brick->getDirty()) _brick->init();
|
||||
if (_volumeTile->getDirty()) _volumeTile->init();
|
||||
|
||||
// otherwise fallback to the Group::traverse()
|
||||
_brick->osg::Group::traverse(nv);
|
||||
_volumeTile->osg::Group::traverse(nv);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osgVolume/Brick>
|
||||
#include <osgVolume/VolumeTile>
|
||||
#include <osgVolume/Volume>
|
||||
|
||||
|
||||
@@ -20,9 +20,9 @@ using namespace osgVolume;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Brick
|
||||
// VolumeTile
|
||||
//
|
||||
Brick::Brick():
|
||||
VolumeTile::VolumeTile():
|
||||
_volume(0),
|
||||
_dirty(false),
|
||||
_hasBeenTraversal(false)
|
||||
@@ -30,7 +30,7 @@ Brick::Brick():
|
||||
setThreadSafeRefUnref(true);
|
||||
}
|
||||
|
||||
Brick::Brick(const Brick& brick,const osg::CopyOp& copyop):
|
||||
VolumeTile::VolumeTile(const VolumeTile& brick,const osg::CopyOp& copyop):
|
||||
Group(brick,copyop),
|
||||
_volume(0),
|
||||
_dirty(false),
|
||||
@@ -43,35 +43,35 @@ Brick::Brick(const Brick& brick,const osg::CopyOp& copyop):
|
||||
}
|
||||
}
|
||||
|
||||
Brick::~Brick()
|
||||
VolumeTile::~VolumeTile()
|
||||
{
|
||||
if (_volume) setVolume(0);
|
||||
}
|
||||
|
||||
void Brick::setVolume(Volume* volume)
|
||||
void VolumeTile::setVolume(Volume* volume)
|
||||
{
|
||||
if (_volume == volume) return;
|
||||
|
||||
if (_volume) _volume->unregisterBrick(this);
|
||||
if (_volume) _volume->unregisterVolumeTile(this);
|
||||
|
||||
_volume = volume;
|
||||
|
||||
if (_volume) _volume->registerBrick(this);
|
||||
if (_volume) _volume->registerVolumeTile(this);
|
||||
}
|
||||
|
||||
void Brick::setBrickID(const BrickID& brickID)
|
||||
void VolumeTile::setTileID(const TileID& tileID)
|
||||
{
|
||||
if (_brickID == brickID) return;
|
||||
if (_tileID == tileID) return;
|
||||
|
||||
if (_volume) _volume->unregisterBrick(this);
|
||||
if (_volume) _volume->unregisterVolumeTile(this);
|
||||
|
||||
_brickID = brickID;
|
||||
_tileID = tileID;
|
||||
|
||||
if (_volume) _volume->registerBrick(this);
|
||||
if (_volume) _volume->registerVolumeTile(this);
|
||||
}
|
||||
|
||||
|
||||
void Brick::traverse(osg::NodeVisitor& nv)
|
||||
void VolumeTile::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
if (!_hasBeenTraversal)
|
||||
{
|
||||
@@ -107,7 +107,7 @@ void Brick::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
}
|
||||
|
||||
void Brick::init()
|
||||
void VolumeTile::init()
|
||||
{
|
||||
if (_volumeTechnique.valid() && getDirty())
|
||||
{
|
||||
@@ -117,7 +117,7 @@ void Brick::init()
|
||||
}
|
||||
}
|
||||
|
||||
void Brick::setVolumeTechnique(VolumeTechnique* volumeTechnique)
|
||||
void VolumeTile::setVolumeTechnique(VolumeTechnique* volumeTechnique)
|
||||
{
|
||||
if (_volumeTechnique == volumeTechnique) return;
|
||||
|
||||
@@ -125,14 +125,14 @@ void Brick::setVolumeTechnique(VolumeTechnique* volumeTechnique)
|
||||
|
||||
if (_volumeTechnique.valid())
|
||||
{
|
||||
_volumeTechnique->_brick = 0;
|
||||
_volumeTechnique->_volumeTile = 0;
|
||||
}
|
||||
|
||||
_volumeTechnique = volumeTechnique;
|
||||
|
||||
if (_volumeTechnique.valid())
|
||||
{
|
||||
_volumeTechnique->_brick = this;
|
||||
_volumeTechnique->_volumeTile = this;
|
||||
++dirtyDelta;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void Brick::setVolumeTechnique(VolumeTechnique* volumeTechnique)
|
||||
else if (dirtyDelta<0) setDirty(false);
|
||||
}
|
||||
|
||||
void Brick::setDirty(bool dirty)
|
||||
void VolumeTile::setDirty(bool dirty)
|
||||
{
|
||||
if (_dirty==dirty) return;
|
||||
|
||||
@@ -156,11 +156,11 @@ void Brick::setDirty(bool dirty)
|
||||
}
|
||||
}
|
||||
|
||||
osg::BoundingSphere Brick::computeBound() const
|
||||
osg::BoundingSphere VolumeTile::computeBound() const
|
||||
{
|
||||
osg::BoundingSphere bs;
|
||||
|
||||
osg::notify(osg::NOTICE)<<"TODO Brick::computeBound()"<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"TODO VolumeTile::computeBound()"<<std::endl;
|
||||
|
||||
return bs;
|
||||
}
|
||||
Reference in New Issue
Block a user