本文整理汇总了C++中NodeRecPtr::getVolume方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeRecPtr::getVolume方法的具体用法?C++ NodeRecPtr::getVolume怎么用?C++ NodeRecPtr::getVolume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeRecPtr
的用法示例。
在下文中一共展示了NodeRecPtr::getVolume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// Initialize GLUT & OpenSG and set up the rootNode
int main(int argc, char **argv)
{
// OSG init
osgInit(argc,argv);
{
// Set up Window
WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
TutorialWindow->initWindow();
SimpleSceneManager sceneManager;
TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));
//Attach to events
TutorialWindow->connectMousePressed(boost::bind(mousePressed, _1, &sceneManager));
TutorialWindow->connectMouseReleased(boost::bind(mouseReleased, _1, &sceneManager));
TutorialWindow->connectMouseMoved(boost::bind(mouseMoved, _1, &sceneManager));
TutorialWindow->connectMouseDragged(boost::bind(mouseDragged, _1, &sceneManager));
// Tell the Manager what to manage
sceneManager.setWindow(TutorialWindow);
UInt32 SceneMask(1),
NanobotMask(2),
PathMask(4);
BoostPath SceneFilePath(".//Data//CellParts.osb");
if(argc >= 2)
{
SceneFilePath = BoostPath(argv[1]);
if(!boost::filesystem::exists(SceneFilePath))
{
SceneFilePath = BoostPath(".//Data//CellParts.osb");
}
}
//Make Base Geometry Node
NodeRecPtr SceneGeometryNode =
SceneFileHandler::the()->read(SceneFilePath.string().c_str());
SceneGeometryNode->setTravMask(SceneMask);
if(SceneGeometryNode == NULL)
{
SceneGeometryNode = makeTorus(1.0, 10.0, 24, 24);
}
//Construct the Root Node
NodeRecPtr RootNode = makeCoredNode<Group>();
RootNode->addChild(SceneGeometryNode);
commitChanges();
//Create the Octree
SLOG << "Started Building Octree" << std::endl;
SLOG << "This may take some time ..." << std::endl;
Time StartTime;
StartTime = getSystemTime();
OctreePtr TheOctree =
Octree::buildTree(RootNode,SceneMask,6,0.5,true);
SLOG << "Building Octree: " << getSystemTime() - StartTime << " s" << std::endl;
Pnt3f Min,Max;
TheOctree->getRoot()->getVolume();
SLOG << "Octree: "<< std::endl
<< " Depth: " << TheOctree->getDepth() << std::endl
<< " Bounds: " << TheOctree->getRoot()->getVolume().getMin() << " : " << TheOctree->getRoot()->getVolume().getMax() << std::endl
<< " NodeCount: " << TheOctree->getNodeCount() << std::endl
<< " LeafNodeCount: " << TheOctree->getLeafNodeCount() << std::endl
<< " BranchNodeCount: " << TheOctree->getBranchNodeCount() << std::endl
<< " IntersectingNodeCount: " << TheOctree->getIntersectingNodeCount() << std::endl
<< " IntersectingLeafNodeCount: " << TheOctree->getIntersectingLeafNodeCount() << std::endl;
//Make the Nanobot Nodes
BoostPath NanobotFilePath(".//Data//Nanobot.osb");
NodeRecPtr NanobotGeoNode =
SceneFileHandler::the()->read(NanobotFilePath.string().c_str());
NanobotVector Nanobots;
UInt32 NumNanobots(3);
for(UInt32 i(0) ; i<NumNanobots ; ++i)
{
NanobotDetails TheDetails;
//Get the Transform node for the Nanobot
TheDetails._Transform = Transform::create();
Matrix NanobotMatrix;
Pnt3f Min,Max;
SceneGeometryNode->getVolume().getBounds(Min,Max);
Min = Min + ShrinkFactor;
Max = Max - ShrinkFactor;
NanobotMatrix.setTranslate(randomOpenPosition(Min,Max,TheOctree).subZero());
NanobotMatrix.setScale(0.06f);
TheDetails._Transform->setMatrix(NanobotMatrix);
TheDetails._Node = makeNodeFor(TheDetails._Transform);
TheDetails._Node->addChild(cloneTree(NanobotGeoNode));
//.........这里部分代码省略.........