Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable caching of NODES that were loaded via 'readNode' #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/osgpcl/outofcore_octree_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ namespace osgpcl
const osg::Vec3d& getBBmin(){return bbmin_;}
bool isLeaf(){return isLeaf_;}
void setLeaf(bool enable){isLeaf_=enable;}

void addCacheHint( const osgDB::Options::CacheHintOptions cho );
};

};
Expand Down
15 changes: 15 additions & 0 deletions src/outofcore_octree_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,23 @@ namespace osgpcl
isRoot_(true),depth_(0), max_depth_(0), depth_set_(false),
bbmin_(0,0,0),bbmax_(0,0,0), isLeaf_(false)
{
addCacheHint( osgDB::Options::CACHE_NODES );
}

OutofCoreOctreeReader::OutOfCoreOptions::OutOfCoreOptions (
osgpcl::PointCloudFactory* factory, float sample) : CloudReaderOptions(factory, sample),
isRoot_(true),depth_(0), max_depth_(0), depth_set_(false),
bbmin_(0,0,0),bbmax_(0,0,0), isLeaf_(false)
{
addCacheHint( osgDB::Options::CACHE_NODES );
}

OutofCoreOctreeReader::OutOfCoreOptions::OutOfCoreOptions (
const OutOfCoreOctree::Ptr& _octree, osgpcl::PointCloudFactory* factory) :
CloudReaderOptions(factory, 1), isRoot_(true),depth_(0), max_depth_(0),
depth_set_(false), bbmin_(0,0,0),bbmax_(0,0,0), isLeaf_(false)
{
addCacheHint( osgDB::Options::CACHE_NODES );
this->init(octree_ );
}

Expand Down Expand Up @@ -282,6 +285,8 @@ namespace osgpcl
this->sampling_rate_ = options.sampling_rate_;
this->isLeaf_ = options.isLeaf_;
this->depth_set_ = options.depth_set_;

this->setObjectCacheHint( options.getObjectCacheHint() );
}

void OutofCoreOctreeReader::OutOfCoreOptions::getBoundingBox (
Expand All @@ -290,6 +295,16 @@ namespace osgpcl
bbmin = bbmin_;
bbmax = bbmax_;
}

void OutofCoreOctreeReader::OutOfCoreOptions::addCacheHint (
const osgDB::Options::CacheHintOptions cho)
{
const osgDB::Options::CacheHintOptions cacheHint =
static_cast<osgDB::Options::CacheHintOptions>( getObjectCacheHint()
| cho )
;
setObjectCacheHint( cacheHint );
}

}

Expand Down