• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ osgExit函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: main


//.........这里部分代码省略.........
        Int32SpinnerModelPtr TheModel(new Int32SpinnerModel());
        TheModel->setMaximum(100);
        TheModel->setMinimum(-100);
        TheModel->setStepSize(1);
        TheModel->setValue(boost::any(Int32(0)));

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

          Create a Spinner and and assign it a 
          Model.

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

        SpinnerRecPtr ExampleSpinner = Spinner::create();
        ExampleSpinner->setModel(TheModel);

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

          Create a RadioButtonPanel to allow
          for certain characteristics of the
          Spinner to be changed dynamically.
          See 14RadioButton for more 
          information about RadioButtons.

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

        RadioButtonRecPtr SingleIncrementButton = RadioButton::create();
        RadioButtonRecPtr DoubleIncrementButton = RadioButton::create();
        SingleIncrementButton->setText("Increment by 1");
        SingleIncrementButton->setPreferredSize(Vec2f(100, 50));
        SingleIncrementButton->connectButtonSelected(boost::bind(handleSingleIncbuttonSelected, _1,
                                                                 TheModel));

        DoubleIncrementButton->setText("Increment by 2");
        DoubleIncrementButton->setPreferredSize(Vec2f(100, 50));
        DoubleIncrementButton->connectButtonSelected(boost::bind(handleDoubleIncbuttonSelected, _1,
                                                                 TheModel));

        RadioButtonGroupRecPtr SelectionRadioButtonGroup = RadioButtonGroup::create();
        SelectionRadioButtonGroup->addButton(SingleIncrementButton);
        SelectionRadioButtonGroup->addButton(DoubleIncrementButton);
        SingleIncrementButton->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(SingleIncrementButton);
        MainInternalWindow->pushToChildren(DoubleIncrementButton);
        MainInternalWindow->pushToChildren(ExampleSpinner);
        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,
                                   "29Spinner");

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

    osgExit();

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


示例17: main


//.........这里部分代码省略.........
    MaterialChunkRefPtr PSMaterialChunk = MaterialChunk::create();
    PSMaterialChunk->setAmbient(Color4f(0.3f,0.3f,0.3f,1.0f));
    PSMaterialChunk->setDiffuse(Color4f(0.7f,0.7f,0.7f,1.0f));
    PSMaterialChunk->setSpecular(Color4f(0.9f,0.9f,0.9f,1.0f));
    PSMaterialChunk->setColorMaterial(GL_AMBIENT_AND_DIFFUSE);

    ChunkMaterialRefPtr PSMaterial = ChunkMaterial::create();
    PSMaterial->addChunk(QuadTextureObjChunk);
    PSMaterial->addChunk(QuadTextureEnvChunk);
    PSMaterial->addChunk(PSMaterialChunk);
    PSMaterial->addChunk(PSBlendChunk);



    //Affector
    ExampleAgeSizeParticleAffector = OSG::AgeSizeParticleAffector::create();
    //ages
    ExampleAgeSizeParticleAffector->editMFAges()->push_back(0.0);
    ExampleAgeSizeParticleAffector->editMFAges()->push_back(0.05);
    ExampleAgeSizeParticleAffector->editMFAges()->push_back(0.2);
    ExampleAgeSizeParticleAffector->editMFAges()->push_back(0.36);
    ExampleAgeSizeParticleAffector->editMFAges()->push_back(0.7);
    ExampleAgeSizeParticleAffector->editMFAges()->push_back(0.8);
    ExampleAgeSizeParticleAffector->editMFAges()->push_back(1.0);

    //sizes
    ExampleAgeSizeParticleAffector->editMFSizes()->push_back(Vec3f(1.0,0.5,1.0));
    ExampleAgeSizeParticleAffector->editMFSizes()->push_back(Vec3f(1.0,0.5,1.0));
    ExampleAgeSizeParticleAffector->editMFSizes()->push_back(Vec3f(20.0,0.5,30.0));
    ExampleAgeSizeParticleAffector->editMFSizes()->push_back(Vec3f(3.0,3.0,3.0));
    ExampleAgeSizeParticleAffector->editMFSizes()->push_back(Vec3f(6.0,60.0,6.0));
    ExampleAgeSizeParticleAffector->editMFSizes()->push_back(Vec3f(2.0,3.0,1.0));
    ExampleAgeSizeParticleAffector->editMFSizes()->push_back(Vec3f(10.0,1.0,10.0));

    //Particle System
    ExampleParticleSystem = OSG::ParticleSystem::create();
    ExampleParticleSystem->attachUpdateListener(TutorialWindow);
    ExampleParticleSystem->pushToAffectors(ExampleAgeSizeParticleAffector);

    //Particle System Drawer
    ExampleParticleSystemDrawer = OSG::QuadParticleSystemDrawer::create();


    ExampleBurstGenerator = OSG::BurstParticleGenerator::create();
    //Attach the function objects to the Generator
    ExampleBurstGenerator->setPositionDistribution(createPositionDistribution());
    ExampleBurstGenerator->setLifespanDistribution(createLifespanDistribution());
    ExampleBurstGenerator->setBurstAmount(10.0);
    ExampleBurstGenerator->setVelocityDistribution(createVelocityDistribution());
    //ExampleBurstGenerator->setAccelerationDistribution(createAccelerationDistribution());
    ExampleBurstGenerator->setSizeDistribution(createSizeDistribution());

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

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

    //Ground Node
    NodeRefPtr GoundNode = makePlane(30.0,30.0,10,10);

    Matrix GroundTransformation;
    GroundTransformation.setRotate(Quaternion(Vec3f(1.0f,0.0,0.0), -3.14195f));
    TransformRefPtr GroundTransformCore = Transform::create();
    GroundTransformCore->setMatrix(GroundTransformation);

    NodeRefPtr GroundTransformNode = Node::create();
    GroundTransformNode->setCore(GroundTransformCore);
    GroundTransformNode->addChild(GoundNode);


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

    mgr->setRoot(scene);

    // Show the whole Scene
    mgr->showAll();


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

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

    osgExit();

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


示例18: main

// Initialize GLUT & OpenSG and set up the scene
int main(int argc, char **argv)
{
    if(argc != 2)
    {
        std::cout << "Usage: 04Xml2Osb.exe [Filename]" << std::endl;
        return -1;
    }

    Path FilePath(argv[1]);
    if(!boost::filesystem::exists(FilePath))
    {
        std::cout << "No file by name: "<< FilePath.string() << " exists." << std::endl;
        return -1;
    }

    // OSG init
    osgInit(argc,argv);
    
    NodePtr TheScene(NullFC);

    //Load the Scene
	FCFileType::FCPtrStore NewContainers;
	NewContainers = FCFileHandler::the()->read(FilePath);

    FCFileType::FCPtrStore::iterator Itor;
    for(Itor = NewContainers.begin() ; Itor != NewContainers.end() ; ++Itor)
    {

        if( (*Itor)->getType() == Node::getClassType() &&
            Node::Ptr::dcast(*Itor)->getParent() == NullFC)
        {
            TheScene =  Node::Ptr::dcast(*Itor);
        }
    }

    //Check if the scene was loaded
    if(TheScene == NullFC)
    {
        std::cout << "Failed to load a scene from: "<< FilePath.string() << "." << std::endl;
        return -1;
    }

    //Run Graph optimizations
    GraphOpSeq *graphop = new GraphOpSeq;
    graphop->addGraphOp(new VerifyGeoGraphOp);
    graphop->addGraphOp(new StripeGraphOp);
    //graphop->addGraphOp(new MaterialMergeGraphOp);
    //graphop->addGraphOp(new SharePtrGraphOp);

    if(graphop != NULL)
    {
        graphop->run(TheScene);
    }



    //Export the Scene to an osb file

    std::string ExportFileName(FilePath.string().substr(0,FilePath.string().size()-3) + "osb");
    
    SceneFileHandler::the().write(TheScene, ExportFileName.c_str());
    
	// OSG exit
    osgExit();

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


示例19: main

// Initialize WIN32 & OpenSG and set up the scene
int main(int argc, char **argv)
{
    preloadSharedObject("OSGTBFileIO");

    // OSG init
    osgInit(argc,argv);

    {
        // Set up Window
        WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
        TutorialWindow->initWindow();

        // Create the SimpleSceneManager helper
        SimpleSceneManager sceneManager;
        TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
        TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));

        // Tell the Manager what to manage
        sceneManager.setWindow(TutorialWindow);

        //Attach to events
        TutorialWindow->connectMousePressed(boost::bind(mousePressed, _1, &sceneManager));
        TutorialWindow->connectMouseReleased(boost::bind(mouseReleased, _1, &sceneManager));
        TutorialWindow->connectMouseDragged(boost::bind(mouseDragged, _1, &sceneManager));
        TutorialWindow->connectMouseWheelMoved(boost::bind(mouseWheelMoved, _1, &sceneManager));
        TutorialWindow->connectKeyTyped(boost::bind(keyTyped, _1));

        // create the scene
        NodeUnrecPtr scene = makeTorus(1.0, 2.0, 16, 16);
        sceneManager.setRoot  (scene);

        //Create the Documentation
        SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TutorialWindow);

        // show the whole scene
        sceneManager.showAll();

        //Load Sound Definitions
        FCFileType::FCPtrStore NewContainers;
        NewContainers = FCFileHandler::the()->read(BoostPath("Data/04SoundData.xml"));

        FCFileType::FCPtrStore::iterator Itor;
        for(Itor = NewContainers.begin() ; Itor != NewContainers.end() ; ++Itor)
        {
            //Get Sounds
            if( (*Itor)->getType().isDerivedFrom(Sound::getClassType()))
            {
                Sounds.push_back(dynamic_pointer_cast<Sound>(*Itor));
                Sounds.back()->connectSoundPlayed  (boost::bind(handleSoundPlayed,   _1));
                Sounds.back()->connectSoundStopped (boost::bind(handleSoundStopped,  _1));
                Sounds.back()->connectSoundPaused  (boost::bind(handleSoundPaused,   _1));
                Sounds.back()->connectSoundUnpaused(boost::bind(handleSoundUnpaused, _1));
                Sounds.back()->connectSoundLooped  (boost::bind(handleSoundLooped,   _1));
            }
            //Get Sound Groups
            if( (*Itor)->getType().isDerivedFrom(SoundGroup::getClassType()))
            {
                SoundGroups.push_back(dynamic_pointer_cast<SoundGroup>(*Itor));
            }
        }

        //Initialize the Sound Manager
        SoundManager::the()->attachUpdateProducer(TutorialWindow);
        SoundManager::the()->setCamera(sceneManager.getCamera());

        Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
        Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
        TutorialWindow->openWindow(WinPos,
                                   WinSize,
                                   "04 XML Sound Loading Window");

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

    }
    osgExit();
    return 0;
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,代码行数:79,代码来源:04XMLSoundLoading.cpp


示例20: main


//.........这里部分代码省略.........

        FCFileType::FCPtrStore ObjStore;
        try
        {
            ObjStore = FCFileHandler::the()->read(FilePath);
        }
        catch(std::exception &ex)
        {
            std::cerr << "Failed to load file: " << FilePath.string() << ", error:"
                     << ex.what()                        << std::endl;
            return -1;
        }
        for(FCFileType::FCPtrStore::iterator StorItor(ObjStore.begin());
            StorItor != ObjStore.end();
            ++StorItor)
        {
            //Animations
            if((*StorItor)->getType().isDerivedFrom(Animation::getClassType()))
            {
                LoadedAnimations.push_back(dynamic_pointer_cast<Animation>(*StorItor));
                LoadedAnimations.back()->attachUpdateProducer(TutorialWindow);
                LoadedAnimations.back()->start();
            }
            //Root Node
            if((*StorItor)->getType() == Node::getClassType() &&
                    dynamic_pointer_cast<Node>(*StorItor)->getParent() == NULL)
            {
                LoadedRoot = dynamic_pointer_cast<Node>(*StorItor);
            }
        }

        if(LoadedRoot == NULL)
        {
            LoadedRoot = SceneFileHandler::the()->read(FilePath.string().c_str());
        }

        if(LoadedRoot == NULL)
        {
            LoadedRoot= makeTorus(.5, 2, 32, 32);
        }

        //Make the fog node
        PostShaderStageRecPtr PostShaderStageCore = PostShaderStage::create();
        PostShaderStageCore->clearPasses();
        PostShaderStageCore->addPass("", generateNoEffectProg());


        DirectionalLightRecPtr SceneLightCore = DirectionalLight::create();
        SceneLightCore->setAmbient(Color4f(0.2f, 0.2f, 0.2f, 1.0f));
        SceneLightCore->setDiffuse(Color4f(0.8f, 0.8f, 0.8f, 1.0f));
        SceneLightCore->setSpecular(Color4f(1.0f, 1.0f, 1.0f, 1.0f));

        NodeRefPtr SceneLight = makeNodeFor(SceneLightCore);
        SceneLight->addChild(LoadedRoot);

        NodeRefPtr PostShaderStageNode = makeNodeFor(PostShaderStageCore);
        PostShaderStageNode->addChild(SceneLight);

        //Make Main Scene Node
        NodeRefPtr scene = makeCoredNode<Group>();

        scene->addChild(PostShaderStageNode);

        // tell the manager what to manage
        sceneManager.setRoot  (scene);
        SceneLightCore->setBeacon(sceneManager.getCamera()->getBeacon());

        //Create the Documentation Foreground and add it to the viewport
        SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TutorialWindow);

        // show the whole scene
        sceneManager.showAll();

        sceneManager.getWindow()->getPort(0)->setTravMask(1);
        RenderOptionsRecPtr ViewportRenderOptions = RenderOptions::create();
        ViewportRenderOptions->setRenderProperties(0x0);
        ViewportRenderOptions->setRenderProperties(RenderPropertiesPool::the()->getFrom1("Default"));
        ViewportRenderOptions->setRenderProperties(0x01);

        sceneManager.getWindow()->getPort(0)->setRenderOptions(ViewportRenderOptions);

        Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
        Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
        TutorialWindow->openWindow(WinPos,
                                   WinSize,
                                   "Collada Loader");

        TutorialWindow->connectKeyPressed(boost::bind(keyPressed, _1,
                                                      TutorialWindow.get(),
                                                      PostShaderStageCore.get()));

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

    }

    osgExit();

    return 0;
}
开发者ID:Himbeertoni,项目名称:OpenSGToolbox,

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ osgInit函数代码示例发布时间:2022-05-30
下一篇:
C++ oserror函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap