本文整理汇总了C++中osg::NodeUnrecPtr::invalidateVolume方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeUnrecPtr::invalidateVolume方法的具体用法?C++ NodeUnrecPtr::invalidateVolume怎么用?C++ NodeUnrecPtr::invalidateVolume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::NodeUnrecPtr
的用法示例。
在下文中一共展示了NodeUnrecPtr::invalidateVolume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void init(std::vector<std::string> &filenames)
{
size_t i;
OSG::DirectionalLightUnrecPtr dl;
OSG::Real32 x,y,z;
OSG::BoxVolume volume;
OSG::Vec3f min,max;
OSG::Vec3f size;
glEnable( GL_DEPTH_TEST );
glEnable( GL_LIGHTING );
glEnable( GL_LIGHT0 );
// GLint twoSide = 1;
// glLightModeliv(GL_LIGHT_MODEL_TWO_SIDE,&twoSide);
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
// create the graph
// beacon for camera and light
OSG::NodeUnrecPtr b1n = OSG::Node::create();
OSG::GroupUnrecPtr b1 = OSG::Group::create();
b1n->setCore( b1 );
// transformation
OSG::NodeUnrecPtr t1n = OSG::Node::create();
OSG::TransformUnrecPtr t1 = OSG::Transform::create();
t1n->setCore( t1 );
t1n->addChild( b1n );
cam_trans = t1;
// light
OSG::NodeUnrecPtr dlight = OSG::Node::create();
dl = OSG::DirectionalLight::create();
dlight->setCore( dl );
dl->setAmbient( .3f, .3f, .3f, 1 );
dl->setDiffuse( 1, 1, 1, 1 );
dl->setDirection(0,0,1);
dl->setBeacon( b1n);
// root
root = OSG::Node::create();
OSG::GroupUnrecPtr gr1 = OSG::Group::create();
root->setCore( gr1 );
root->addChild( t1n );
root->addChild( dlight );
// Load the file
OSG::NodeUnrecPtr scene = OSG::Node::create();
scene->setCore(OSG::Group::create());
OSG::NodeUnrecPtr file;
for(i=0;i<filenames.size();i++)
{
file = OSG::SceneFileHandler::the()->read(filenames[i].c_str(),0);
if(file != NULL)
scene->addChild(file);
else
std::cerr << "Couldn't load file, ignoring " << filenames[i] << std::endl;
}
if ( filenames.size()==0 )
{
file = OSG::makeTorus( .5, 2, 16, 16 );
scene->addChild(file);
// scene->addChild(makeBox(.6,.6,.6,5,5,5));
}
prepareSceneGraph(scene);
OSG::Thread::getCurrentChangeList()->commitChanges();
scene->invalidateVolume();
scene->updateVolume();
volume=scene->getVolume();
volume.getBounds(min,max);
size = max-min;
if(ca>0)
{
if(cb==-1)
cb=ca;
if(cc==-1)
cc=cb;
OSG::NodeUnrecPtr node;
OSG::NodeUnrecPtr geoNode;
OSG::TransformUnrecPtr trans;
for(x=-ca/2.0 ; x<ca/2.0 ; x++)
for(y=-cb/2.0 ; y<cb/2.0 ; y++)
for(z=-cc/2.0 ; z<cc/2.0 ; z++)
{
trans=OSG::Transform::create();
node=OSG::Node::create();
node->setCore(trans);
//.........这里部分代码省略.........