本文整理汇总了C++中SimpleSceneManager::setStatistics方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleSceneManager::setStatistics方法的具体用法?C++ SimpleSceneManager::setStatistics怎么用?C++ SimpleSceneManager::setStatistics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleSceneManager
的用法示例。
在下文中一共展示了SimpleSceneManager::setStatistics方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
ExampleParticleSystem->addParticle(Pnt3f(0,0,-100),Vec3f(0,1,0),Color4f(1,1,1,1),Vec3f(1,1,1),0.1,Vec3f(0,0,0),Vec3f(0,0,0));
ExampleParticleSystem->addParticle(Pnt3f(0,0,100),Vec3f(0,1,0),Color4f(1,1,1,1),Vec3f(1,1,1),0.1,Vec3f(0,0,0),Vec3f(0,0,0));
ExampleParticleSystem->setMaxParticles(5); // 5 rockets max to avoid collisions. they are bad.
ExampleParticleSystem->pushToAffectors(AgeFadeAffector);
ExampleParticleSystem->attachUpdateProducer(TutorialWindow);
//Creating Particle System Drawer
QuadParticleSystemDrawerRefPtr ExampleParticleSystemDrawer = QuadParticleSystemDrawer::create();
ExampleParticleSystemDrawer->setNormalAndUpSource(QuadParticleSystemDrawer::NORMAL_VIEW_DIRECTION,
QuadParticleSystemDrawer::UP_VELOCITY);
QuadParticleSystemDrawerRefPtr ExampleTrailDrawer = QuadParticleSystemDrawer::create();
ExampleTrailDrawer->setNormalAndUpSource(QuadParticleSystemDrawer::NORMAL_VIEW_DIRECTION,
QuadParticleSystemDrawer::UP_PARTICLE_NORMAL);
// Attaching affector and generator to the particle system
ExampleParticleSystem->pushToGenerators(ExampleGenerator);
//Particle System Core, setting its system, drawer, and material
ParticleSystemCoreRefPtr ParticleNodeCore = ParticleSystemCore::create();
ParticleNodeCore->setSystem(ExampleParticleSystem);
ParticleNodeCore->setDrawer(ExampleParticleSystemDrawer);
ParticleNodeCore->setMaterial(PSMaterial);
// create Particle System Particle Trail generator
ParticleSystemParticleTrailGeneratorRecPtr ExamplePSTrailGenerator = ParticleSystemParticleTrailGenerator::create();
ExamplePSTrailGenerator->setTrailResolution(0.05f);
ExamplePSTrailGenerator->setTrailLength(1.2);
ExamplePSTrailGenerator->setTrailLengthMethod(ParticleTrailGenerator::TIME);
ExamplePSTrailGenerator->setTrailResolutionMethod(ParticleTrailGenerator::TIME_SPACING);
ExamplePSTrailGenerator->setTrailMaterial(TrailMaterial);
ExamplePSTrailGenerator->setTrailDrawer(ExampleTrailDrawer);
ExamplePSTrailGenerator->setSizeDistribution(createTrailSizeDistribution());
ExamplePSTrailGenerator->setColorDistribution(createColorDistribution());
ExamplePSTrailGenerator->setNormalDistribution(createNormalDistribution());
ExamplePSTrailGenerator->setVelocityDistribution(createNormalDistribution());
// create affectors for particle trails
GravityParticleAffectorRefPtr GravAffector = GravityParticleAffector::create();
GravAffector->setBeacon(ExamplePSTrailGenerator);
AgeFadeParticleAffectorRefPtr TrailAgeFadeAffector = AgeFadeParticleAffector::create();
TrailAgeFadeAffector->setFadeInTime(0.2f);
TrailAgeFadeAffector->setStartAlpha(0.0f);
TrailAgeFadeAffector->setEndAlpha(0.0f);
TrailAgeFadeAffector->setFadeOutTime(1.0f);
TrailAgeFadeAffector->setFadeToAlpha(0.6f);
// now we attach the affector to the particle trail generator's particle system
ExamplePSTrailGenerator->getParticleSystem()->pushToAffectors(TrailAgeFadeAffector);
// attach listener for trail generator to the particle system
ExamplePSTrailGenerator->setSystemToTrail(ExampleParticleSystem);
//Attach the the update producer to the particle system particle trail generator.
ExamplePSTrailGenerator->attachUpdateProducer(TutorialWindow);
// Set up node with the particle system at its core
NodeRefPtr ParticleNode = Node::create();
ParticleNode->setCore(ParticleNodeCore);
ParticleNode->addChild(ExamplePSTrailGenerator);
// Make Main Scene Node
NodeRefPtr scene = Node::create();
scene->setCore(Group::create());
scene->addChild(ParticleNode);
sceneManager.setRoot(scene);
// Show the whole Scene
sceneManager.showAll();
sceneManager.getCamera()->setFar(10000.0f);
sceneManager.getCamera()->setNear(0.1f);
sceneManager.setStatistics(false);
//Open Window
Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
TutorialWindow->openWindow(WinPos,
WinSize,
"02ParticleSystemParticleTrail");
std::cout << "Controls: " << std::endl
<< "P: Increase Trail Resolution" << std::endl
<< "L: Decrease Trail Resolution" << std::endl
<< "O: Increase Trail Length" << std::endl
<< "K: Decrease Trail Length" << std::endl
<< "J: Toggle calculating trail length by num points/time" << std::endl
<< "Y: Toggle calculating trail point spacing by time/distance" << std::endl
<< "B: Particle burst" << std::endl;
//Enter main Loop
TutorialWindow->mainLoop();
}
osgExit();
return 0;
}
示例2: main
// Initialize WIN32 & OpenSG and set up the scene
int main(int argc, char **argv)
{
// OSG init
osgInit(argc,argv);
{
// create the scene
NodeRecPtr scene = makeTorus(.5, 2, 16, 16);
//Create a Window object
WindowEventProducerRefPtr TheWindow = createNativeWindow();
//Apply window settings
TheWindow->setUseCallbackForDraw(true);
TheWindow->setUseCallbackForReshape(true);
//TheWindow->setFullscreen(true);
//Initialize Window
TheWindow->initWindow();
commitChanges();
// create the SimpleSceneManager helper
SimpleSceneManager sceneManager;
TheWindow->setDisplayCallback(boost::bind(display, &sceneManager));
TheWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));
// tell the manager what to manage
sceneManager.setWindow(TheWindow);
sceneManager.setRoot (scene);
//Attach to the Mouse Events
TheWindow->connectMouseClicked(boost::bind(mouseClicked, _1));
TheWindow->connectMousePressed(boost::bind(mousePressed, _1, &sceneManager));
TheWindow->connectMouseReleased(boost::bind(mouseReleased, _1, &sceneManager));
TheWindow->connectMouseMoved(boost::bind(mouseMoved, _1, &sceneManager));
TheWindow->connectMouseDragged(boost::bind(mouseDragged, _1, &sceneManager));
TheWindow->connectMouseEntered(boost::bind(mouseEntered, _1));
TheWindow->connectMouseExited(boost::bind(mouseExited, _1));
TheWindow->connectMouseWheelMoved(boost::bind(mouseWheelMoved, _1, &sceneManager));
//Attach to the Key Events
TheWindow->connectKeyPressed(boost::bind(keyPressed, _1));
TheWindow->connectKeyReleased(boost::bind(keyReleased, _1));
TheWindow->connectKeyTyped(boost::bind(keyTyped, _1));
//Attach to the Window Events
TheWindow->connectWindowOpened(boost::bind(windowOpened, _1));
TheWindow->connectWindowClosing(boost::bind(windowClosing, _1));
TheWindow->connectWindowClosed(boost::bind(windowClosed, _1));
TheWindow->connectWindowIconified(boost::bind(windowIconified, _1));
TheWindow->connectWindowDeiconified(boost::bind(windowDeiconified, _1));
TheWindow->connectWindowActivated(boost::bind(windowActivated, _1));
TheWindow->connectWindowDeactivated(boost::bind(windowDeactivated, _1));
TheWindow->connectWindowEntered(boost::bind(windowEntered, _1));
TheWindow->connectWindowExited(boost::bind(windowExited, _1));
//Create the Documentation Foreground and add it to the viewport
SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TheWindow);
// show the whole scene
sceneManager.showAll();
// show statistics
sceneManager.setStatistics(true);
//Open Window
Vec2f WinSize(TheWindow->getDesktopSize() * 0.85f);
Pnt2f WinPos((TheWindow->getDesktopSize() - WinSize) *0.5);
TheWindow->openWindow(WinPos,
WinSize,
"01 Native Window");
//Enter main loop
TheWindow->mainLoop();
}
osgExit();
return 0;
}