当前位置: 首页>>代码示例>>C++>>正文


C++ osgExit函数代码示例

本文整理汇总了C++中osgExit函数的典型用法代码示例。如果您正苦于以下问题:C++ osgExit函数的具体用法?C++ osgExit怎么用?C++ osgExit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了osgExit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: keyboard

static void keyboard(unsigned char k, int, int)
{
    switch(k)
    {
    case 27:
    case 'q':
    case 'Q':
    {
        cleanup();
        osgExit();

        std::exit(EXIT_SUCCESS);
    }
    break;

    case '1':
    {
        UInt32 width  = win->getWidth();
        UInt32 height = win->getHeight();

        std::cout << "Creating acquisition stage "
                  << width << "x" << height
                  << std::endl;

        if (!dynamicVp) {
            createAcquisitionStage();
            createDynamicViewport();
        } else {
            enableStaticScene();
        }
    }
    break;
    }
    glutPostRedisplay();
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:35,代码来源:dyndrawing1.cpp

示例2: keyboard

// react to keys
void keyboard(unsigned char k, int, int)
{
    switch(k)
    {
    case 27:    osgExit();
                exit(1);
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:9,代码来源:testPolygonForeground.cpp

示例3: keyboard

void keyboard(unsigned char k, int, int)
{
    switch(k)
    {
    case 27:
        cleanup();
        osgExit();

        exit(0);
        break;

    case 'q':
        toggleAnim(0, false);
        break;
    case 'w':
        toggleAnim(0, true);
        break;
    case 'e':
        resetAnim(0);
        break;
    case 'r':
        toggleAnimEnable(0);
        break;
    case 't':
        increaseTimeScale(0);
        break;
    case 'y':
        decreaseTimeScale(0);
        break;
    case 'u':
        toggleAnimDirection(0);
        break;

    case 'a':
        toggleAnim(1, false);
        break;
    case 's':
        toggleAnim(1, true);
        break;
    case 'd':
        resetAnim(1);
        break;
    case 'f':
        toggleAnimEnable(1);
        break;
    case 'g':
        increaseTimeScale(1);
        break;
    case 'h':
        decreaseTimeScale(1);
        break;
    case 'j':
        toggleAnimDirection(1);
        break;
    }
}
开发者ID:Himbeertoni,项目名称:OpenSGDevMaster,代码行数:56,代码来源:testTrivialAnim3.cpp

示例4: fini

void fini(void)
{
    delete mgr;
    mgr    = NULL;
    
    cubesN = NULL;
    cubes  = NULL;

    commitChanges();

    osgExit();
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:12,代码来源:cubesApp.cpp

示例5: main

//
// main entry point
//
int main(int argc, char *argv[])
{
    int ret = doMain(argc, argv);

    glutMainLoop();

    cleanup();

    osgExit();

    return ret;
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:15,代码来源:dyndrawing1.cpp

示例6: cleanup

void cleanup() {

//----------------------------------------------------------------------------//
// Snippet-1-4 - BEGIN                                                        //
//----------------------------------------------------------------------------//
	SystemCore::cleanup(); // clean up SystemCore and registered components
//----------------------------------------------------------------------------//
// Snippet-1-4 - END                                                          //
//----------------------------------------------------------------------------//

	osgExit();
}
开发者ID:flair2005,项目名称:inVRs,代码行数:12,代码来源:MedievalTown.cpp

示例7: _fMainloop

void ComplexSceneManager::run(void)
{
    if(_fMainloop)
    {
        _fMainloop();
    }
    else
    {
        FWARNING(("ComplexSceneManager: no mainloop exiting\n"));
    }

    osgExit(); 
}
开发者ID:Langkamp,项目名称:OpenSGDevMaster_Toolbox,代码行数:13,代码来源:OSGComplexSceneManager.cpp

示例8: main

int main(int argc, char *argv[])
{
    osgInit(argc, argv);

    std::cout << "testAnimTemplate" << std::endl;
    testAnimTemplate();

    std::cout << "testAnim" << std::endl;
    testAnim();

    osgExit();

    return 0;
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:14,代码来源:testTrivialAnim.cpp

示例9: main

// Activate the OpenSG namespace
OSG_USING_NAMESPACE

int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    NodePtr mpNode = Node::create();
    MaterialPoolPtr mp = MaterialPool::create();
    beginEditCP(mpNode);
        mpNode->setCore(mp);
    endEditCP(mpNode);

    // create some materials
    SimpleMaterialPtr mat1 = SimpleMaterial::create();
    beginEditCP(mat1);
        mat1->setAmbient(Color3f(0.2, 0.2, 0.2));
        mat1->setDiffuse(Color3f(1,0,0));
    endEditCP(mat1);

    SimpleMaterialPtr mat2 = SimpleMaterial::create();
    beginEditCP(mat2);
        mat2->setAmbient(Color3f(0.2, 0.2, 0.2));
        mat2->setDiffuse(Color3f(0,1,0));
    endEditCP(mat2);
    
    // this adds a material to the material pool. You can also add
    // all materials from a subtree via mp->add(node)
    beginEditCP(mp);
        mp->add(mat1);
        mp->add(mat2);
    endEditCP(mp);

    // now write the material pool out.
    SceneFileHandler::the().write(mpNode, "materials.osb");

    osgExit();

    return 0;
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:41,代码来源:testMaterialPool.cpp

示例10: keyboard

static void keyboard(unsigned char k, int, int)
{
    UInt32 winWidth  = win->getWidth();
    UInt32 winHeight = win->getHeight();

    UInt32 width  = fw * winWidth;
    UInt32 height = fh * winHeight;

    switch(k)
    {
    case 27:
    case 'q':
    case 'Q':
    {
        cleanup();
        osgExit();

        std::exit(EXIT_SUCCESS);
    }
    break;

    case '1':
    {
        std::cout << "Creating screenshot (Grab FG) "
                  << width << "x" << height << " in '" << output_file
                  << std::endl;
        writeHiResScreenShot(output_file, width, height);
    }
    break;
    case '2':
    {
        std::cout << "Creating screenshot (FBO) "
                  << width << "x" << height << " in '" << output_file_fbo
                  << std::endl;
        writeHiResScreenShotFBO(output_file_fbo, width, height);
    }
    break;
    }
    glutPostRedisplay();
}
开发者ID:jondo2010,项目名称:OpenSG,代码行数:40,代码来源:hiresimage.cpp

示例11: keyboard

// react to keys
void keyboard(unsigned char k, int , int )
{
    switch(k)
    {
        case 27:
        {
            osgExit();
            exit(1);
        }
        break;

        case '0':   case '1':   case '2':   case '3':   case '4':   
        case '5':   case '6':   case '7':   case '8':   case '9': 
        {   
            beginEditCP(sw, Switch::ChoiceFieldMask);
            sw->setChoice(k - '0');
            endEditCP(sw, Switch::ChoiceFieldMask);
            break;
        }
        break;

        case 'a':
        {
            beginEditCP(sw, Switch::ChoiceFieldMask);
            sw->setChoice(Switch::ALL); 
            endEditCP(sw, Switch::ChoiceFieldMask);
        }
        break;

        case 'n':
        {
            beginEditCP(sw, Switch::ChoiceFieldMask);
            sw->setChoice(Switch::NONE); 
            endEditCP(sw, Switch::ChoiceFieldMask);
        }
        break;
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:39,代码来源:14switch.cpp

示例12: keyboard

// react to keys
void keyboard(unsigned char k, int, int)
{
    switch(k)
    {
        case 27:    osgExit();
            exit(1);
        case 'c':
            beginEditCP(colorFilterPtr);
            colorFilterPtr->setEnabled(!colorFilterPtr->getEnabled());
            endEditCP(colorFilterPtr);
            break;
        case 'r':
            beginEditCP(resolutionFilterPtr);
            resolutionFilterPtr->setEnabled(!resolutionFilterPtr->getEnabled());
            endEditCP(resolutionFilterPtr);
            break;
        case 'd':
            beginEditCP(distortionFilterPtr);
            distortionFilterPtr->setEnabled(!distortionFilterPtr->getEnabled());
            endEditCP(distortionFilterPtr);
            break;
    }
}
开发者ID:mlimper,项目名称:OpenSG1x,代码行数:24,代码来源:testDisplayFilter.cpp

示例13: main


//.........这里部分代码省略.........
        TutorialWindow->connectKeyTyped(boost::bind(keyPressed, _1));

        // Make Torus Node (creates Torus in background of scene)
        NodeRecPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);

        // Make Main Scene Node and add the Torus
        NodeRecPtr scene = Node::create();
        scene->setCore(Group::create());
        scene->addChild(TorusGeometryNode);

        // Create the Graphics
        GraphicsRecPtr TutorialGraphics = Graphics2D::create();

        // Initialize the LookAndFeelManager to enable default settings
        LookAndFeelManager::the()->getLookAndFeel()->init();


        /******************************************************

          Create and edit a CheckboxButton.

Note: the only function call shown 
specific to	CheckboxButton is setSelected.
In DefaultLookAndFeel, the options 
for changing the style of the CheckBox
are shown.  CheckboxButton also 
inherits off Button so all features
of Button may be used.

-setSelected(bool): Determines if the 
CheckboxButton is checked(true) or 
not checked(false).

         ******************************************************/
        CheckboxButtonRecPtr ExampleCheckboxButton = CheckboxButton::create();
        ExampleCheckboxButton->setMinSize(Vec2f(50, 25));
        ExampleCheckboxButton->setMaxSize(Vec2f(300, 100));
        ExampleCheckboxButton->setPreferredSize(Vec2f(200, 50));
        ExampleCheckboxButton->setEnabled(true);
        ExampleCheckboxButton->setText("Checkbox Button");
        ExampleCheckboxButton->setAlignment(Vec2f(0.5,0.5));
        ExampleCheckboxButton->setSelected(true);


        // Create The Main InternalWindow
        // Create Background to be used with the Main InternalWindow
        ColorLayerRecPtr MainInternalWindowBackground = ColorLayer::create();
        MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5));

        LayoutRecPtr MainInternalWindowLayout = FlowLayout::create();

        InternalWindowRecPtr MainInternalWindow = InternalWindow::create();
        MainInternalWindow->pushToChildren(ExampleCheckboxButton);
        MainInternalWindow->setLayout(MainInternalWindowLayout);
        MainInternalWindow->setBackgrounds(MainInternalWindowBackground);
        MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f));
        MainInternalWindow->setScalingInDrawingSurface(Vec2f(0.5f,0.5f));
        MainInternalWindow->setDrawTitlebar(false);
        MainInternalWindow->setResizable(false);

        // Create the Drawing Surface
        UIDrawingSurfaceRecPtr TutorialDrawingSurface = UIDrawingSurface::create();
        TutorialDrawingSurface->setGraphics(TutorialGraphics);
        TutorialDrawingSurface->setEventProducer(TutorialWindow);

        TutorialDrawingSurface->openWindow(MainInternalWindow);

        // Create the UI Foreground Object
        UIForegroundRecPtr TutorialUIForeground = UIForeground::create();

        TutorialUIForeground->setDrawingSurface(TutorialDrawingSurface);



        // Tell the Manager what to manage
        sceneManager.setRoot(scene);

        // Add the UI Foreground Object to the Scene
        ViewportRecPtr TutorialViewport = sceneManager.getWindow()->getPort(0);
        TutorialViewport->addForeground(TutorialUIForeground);

        // Show the whole Scene
        sceneManager.showAll();


        //Open Window
        Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
        Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
        TutorialWindow->openWindow(WinPos,
                                   WinSize,
                                   "13CheckboxButton");

        //Enter main Loop
        TutorialWindow->mainLoop();
    }

    osgExit();

    return 0;
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:101,代码来源:13CheckboxButton.cpp

示例14: main


//.........这里部分代码省略.........
    setName(scene, "scene");
    rootNode = Node::create();
    setName(rootNode, "rootNode");
    ComponentTransformRefPtr Trans;
    Trans = ComponentTransform::create();
    {
        rootNode->setCore(Trans);
 
        // add the torus as a child
        rootNode->addChild(scene);
    }

    //Make The Physics Characteristics Node
    PhysicsCharacteristicsDrawableUnrecPtr PhysDrawable = PhysicsCharacteristicsDrawable::create();
        PhysDrawable->setRoot(rootNode);

	PhysDrawableNode = Node::create();
    PhysDrawableNode->setCore(PhysDrawable);
    PhysDrawableNode->setTravMask(TypeTraits<UInt32>::getMin());

    rootNode->addChild(PhysDrawableNode);

    //Light Beacon
    NodeRefPtr TutorialLightBeacon = makeCoredNode<Transform>();

    //Light Node
    DirectionalLightRefPtr TutorialLight = DirectionalLight::create();
    TutorialLight->setDirection(0.0,0.0,-1.0);
    TutorialLight->setBeacon(TutorialLightBeacon);

    NodeRefPtr TutorialLightNode = Node::create();
    TutorialLightNode->setCore(TutorialLight);

    scene->addChild(TutorialLightNode);
    scene->addChild(TutorialLightBeacon);


    //Setup Physics Scene
    physicsWorld = PhysicsWorld::create();
        physicsWorld->setWorldContactSurfaceLayer(0.01);
        physicsWorld->setAutoDisableFlag(1);
        physicsWorld->setAutoDisableTime(0.75);
        physicsWorld->setWorldContactMaxCorrectingVel(1.0);
        //physicsWorld->setGravity(Vec3f(0.0, 0.0, -9.81));
        //physicsWorld->setCfm(0.001);
        //physicsWorld->setErp(0.2);

    hashSpace = PhysicsHashSpace::create();

    physHandler = PhysicsHandler::create();
        physHandler->setWorld(physicsWorld);
        physHandler->pushToSpaces(hashSpace);
        physHandler->setUpdateNode(rootNode);
    physHandler->attachUpdateProducer(TutorialWindow->editEventProducer());
    

        rootNode->addAttachment(physHandler);    
        rootNode->addAttachment(physicsWorld);
        rootNode->addAttachment(hashSpace);


	/************************************************************************/
	/* create spaces, geoms and bodys                                                                     */
	/************************************************************************/
    //create a group for our space
    GroupRefPtr spaceGroup;
	spaceGroupNode = makeCoredNode<Group>(&spaceGroup);
	//add Attachments to nodes...
	    spaceGroupNode->addAttachment(hashSpace);

	    TutorialLightNode->addChild(spaceGroupNode);

    //Create Character
    ShipBody = buildShip(Vec3f(3.0,3.0,10.0), Pnt3f((Real32)(rand()%100)-50.0,(Real32)(rand()%100)-50.0,25.0));
    ShipMotor = buildMotor(ShipBody);

    for(UInt32 i(0) ; i<5 ; ++i)
    {
        buildBox(Vec3f(10.0,10.0,10.0), Pnt3f((Real32)(rand()%100)-50.0,(Real32)(rand()%100)-50.0,25.0));
    }

    // tell the manager what to manage
    mgr->setRoot  (rootNode);

    // show the whole rootNode
    mgr->showAll();
    
    Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
    Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
    TutorialWindow->openWindow(WinPos,
            WinSize,
            "04ZeroGravityShip");

    //Enter main Loop
    TutorialWindow->mainLoop();

    osgExit();

    return 0;
}
开发者ID:Langkamp,项目名称:OpenSGToolbox,代码行数:101,代码来源:04ZeroGravityShip.cpp

示例15: main


//.........这里部分代码省略.........
        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));
        TutorialWindow->connectMouseWheelMoved(boost::bind(mouseWheelMoved, _1, &sceneManager));
        TutorialWindow->connectKeyTyped(boost::bind(keyTyped, _1, &sceneManager));

        //Particle System Material
        PointChunkRefPtr PSPointChunk = PointChunk::create();
        PSPointChunk->setSize(5.0f);
        PSPointChunk->setSmooth(true);
        BlendChunkRefPtr PSBlendChunk = BlendChunk::create();
        PSBlendChunk->setSrcFactor(GL_SRC_ALPHA);
        PSBlendChunk->setDestFactor(GL_ONE_MINUS_SRC_ALPHA);

        MaterialChunkRefPtr PSMaterialChunkChunk = MaterialChunk::create();
        PSMaterialChunkChunk->setAmbient(Color4f(0.3f,0.3f,0.3f,1.0f));
        PSMaterialChunkChunk->setDiffuse(Color4f(0.7f,0.7f,0.7f,1.0f));
        PSMaterialChunkChunk->setSpecular(Color4f(0.9f,0.9f,0.9f,1.0f));
        PSMaterialChunkChunk->setColorMaterial(GL_AMBIENT_AND_DIFFUSE);

        ChunkMaterialRefPtr PSMaterial = ChunkMaterial::create();
        PSMaterial->addChunk(PSPointChunk);
        PSMaterial->addChunk(PSMaterialChunkChunk);
        PSMaterial->addChunk(PSBlendChunk);

        Distribution3DRefPtr PositionDistribution = createPositionDistribution();

        Pnt3f PositionReturnValue;

        //Particle System
        ParticleSystemRefPtr ExampleParticleSystem = ParticleSystem::create();
        for(UInt32 i(0) ; i<500 ; ++i)//controls how many particles are created
        {
            if(PositionDistribution != NULL)
            {
                PositionReturnValue = Pnt3f(PositionDistribution->generate());
            }

            ExampleParticleSystem->addParticle(
                                               PositionReturnValue,
                                               Vec3f(0.0f,0.0f,1.0f),
                                               Color4f(1.0,0.0,0.0,1.0), 
                                               Vec3f(1.0,1.0,1.0), 
                                               -1, 
                                               Vec3f(0.0f,0.0f,0.0f), //Velocity
                                               Vec3f(0.0f,0.0f,0.0f)	//acceleration
                                              );
        }
        ExampleParticleSystem->attachUpdateProducer(TutorialWindow);

        //Particle System Drawer
        PointParticleSystemDrawerRefPtr ExampleParticleSystemDrawer = PointParticleSystemDrawer::create();



        //Particle System Node
        ParticleSystemCoreRefPtr ParticleNodeCore = ParticleSystemCore::create();
        ParticleNodeCore->setSystem(ExampleParticleSystem);
        ParticleNodeCore->setDrawer(ExampleParticleSystemDrawer);
        ParticleNodeCore->setMaterial(PSMaterial);

        NodeRefPtr ParticleNode = Node::create();
        ParticleNode->setCore(ParticleNodeCore);


        // Make Main Scene Node and add the Torus
        NodeRefPtr scene = Node::create();
        scene->setCore(Group::create());
        scene->addChild(ParticleNode);

        sceneManager.setRoot(scene);

        // Show the whole Scene
        sceneManager.showAll();

        //Create an DistanceKill
        DistanceKillParticleAffectorRefPtr ExampleDistanceKillParticleAffector = DistanceKillParticleAffector::create();
        ExampleDistanceKillParticleAffector->setKillDistance(1000.0f);
        ExampleDistanceKillParticleAffector->setParticleSystemNode(ParticleNode);
        ExampleDistanceKillParticleAffector->setDistanceFromSource(DistanceKillParticleAffector::DISTANCE_FROM_CAMERA);
        ExampleDistanceKillParticleAffector->setDistanceFromCamera(sceneManager.getCamera());

        ExampleParticleSystem->pushToAffectors(ExampleDistanceKillParticleAffector);

        //Open Window
        Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
        Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
        TutorialWindow->openWindow(WinPos,
                                   WinSize,
                                   "09DistanceKillParticleAffector");

        //Enter main Loop
        TutorialWindow->mainLoop();

    }
    osgExit();

    return 0;
}
开发者ID:achvas88,项目名称:OpenSGToolbox,代码行数:101,代码来源:09DistanceKillParticleAffector.cpp


注:本文中的osgExit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。