本文整理汇总了C++中NodeUnrecPtr::getVolume方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeUnrecPtr::getVolume方法的具体用法?C++ NodeUnrecPtr::getVolume怎么用?C++ NodeUnrecPtr::getVolume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeUnrecPtr
的用法示例。
在下文中一共展示了NodeUnrecPtr::getVolume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main (int argc, char **argv)
{
osgInit(argc,argv);
// GLUT init
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowSize (uiSize, uiSize);
glutInitWindowPosition(100,100);
int winid = glutCreateWindow("OpenSG");
glutKeyboardFunc(key);
glutVisibilityFunc(vis);
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutMouseFunc(mouse);
glutMotionFunc(motion);
glutIdleFunc(display);
// OSG
SceneFileHandler::the()->print();
// create the graph
// beacon for camera and light
NodeUnrecPtr b1n = Node::create();
GroupUnrecPtr b1 = Group::create();
b1n->setCore( b1 );
// transformation
NodeUnrecPtr t1n = Node::create();
TransformUnrecPtr t1 = Transform::create();
t1n->setCore (t1 );
t1n->addChild(b1n);
cam_trans = t1;
// light
NodeUnrecPtr dlight = Node::create();
DirectionalLightUnrecPtr dl = DirectionalLight::create();
{
dlight->setCore(dl);
dl->setAmbient( .0, .0, .0, 1 );
dl->setDiffuse( .8, .8, .8, .8 );
dl->setDirection(0,0,1);
dl->setBeacon( b1n);
}
// root
root = Node:: create();
GroupUnrecPtr gr1 = Group::create();
root->setCore (gr1 );
root->addChild(t1n );
root->addChild(dlight);
// Load the file
NodeUnrecPtr file = NULL;
if(argc > 1)
{
file = SceneFileHandler::the()->read(argv[1], NULL);
}
if(file == NULL)
{
std::cerr << "Couldn't load file, ignoring" << std::endl;
file = makeSphere(4, 20.0);
}
Thread::getCurrentChangeList()->commitChanges();
file->updateVolume();
Vec3f min,max;
file->getVolume().getBounds(min, max);
std::cout << "Volume: from " << min << " to " << max << std::endl;
scene_trans = Transform::create();
NodeUnrecPtr sceneTrN = Node::create();
sceneTrN->setCore (scene_trans);
sceneTrN->addChild(file );
ref_trans = Transform::create();
//.........这里部分代码省略.........
示例2: doMain
//.........这里部分代码省略.........
SimpleMaterialUnrecPtr pEllMat = SimpleMaterial::create();
pEllMat->editDiffuse().setValuesRGB(0.3, 0.3, 0.3);
pEllMatG->setMaterial(pEllMat);
pEll->setCore(pEllMatG);
pEll->addChild(makeLatLongEllipsoid(18,
36,
6378137. * 0.95,
6356752.3142 * 0.95));
geoRef->addChild(pEll);
geoRef->addChild(makeEllipsoidAxis(18,
36,
6378137. * 1.05,
6356752.3142 * 1.05));
file = geoRef; //makeSphere(4, 2.0);
#endif
file = makeSphere(4, 2.0);
}
Thread::getCurrentChangeList()->commitChanges();
file->updateVolume();
Vec3f min,max;
file->getVolume().getBounds(min, max);
std::cout << "Volume: from " << min << " to " << max << std::endl;
/*
min[0] = -500;
min[1] = 0;
min[2] = -500;
max[0] = 500;
max[1] = 100;
max[2] = 500;
*/
scene_trans = Transform::create();
NodeUnrecPtr sceneTrN = Node::create();
sceneTrN->setCore (scene_trans);
sceneTrN->addChild(file );
AlgorithmStageUnrecPtr pAlgoStage = AlgorithmStage::create();
pAlgoStage->setInheritedTarget(true);
pAlgoStage->setProjectionMode (AlgorithmStage::Ignore);
pAlgoStage->setCopyViewing (true);
CallbackAlgorithmUnrecPtr pAlgo = CallbackAlgorithm::create();
pAlgo->setCallback(&terrainRenderCB, "");
pAlgoStage->setAlgorithm(pAlgo);
NodeUnrecPtr pAlgoNode = Node::create();