Show
Ignore:
Timestamp:
01/10/07 14:52:22 (8 years ago)
Author:
robert
Message:

Ported following examples to osgViewer:

osgparticleeffects
osgphotoalbum
osgpick
osgpoints
osgpointsprite
osgprecipitation
osgprerender
osgprerendercubemap
osgreflect
osgscalarbar
osgscribe
osgsequence
osgplanets

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgprerender/osgprerender.cpp

    r5757 r5954  
    1111#include <osg/Billboard> 
    1212#include <osg/Material> 
     13#include <osg/AnimationPath> 
    1314 
    1415#include <osgGA/TrackballManipulator> 
     
    2122#include <osgDB/ReadFile> 
    2223 
    23 #include <osgProducer/Viewer> 
    24  
     24#include <osgViewer/Viewer> 
     25 
     26#include <iostream> 
    2527 
    2628// call back which cretes a deformation field to oscilate the model. 
     
    385387    
    386388    // construct the viewer. 
    387     osgProducer::Viewer viewer(arguments); 
    388  
    389     // set up the value with sensible default event handlers. 
    390     viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); 
    391  
    392     // get details on keyboard and mouse bindings used by the viewer. 
    393     viewer.getUsage(*arguments.getApplicationUsage()); 
     389    osgViewer::Viewer viewer; 
    394390 
    395391    // if user request help write it out to cout. 
     
    422418    while (arguments.read("--hdr")) { useHDR = true; } 
    423419 
    424     // any option left unread are converted into errors to write out later. 
    425     arguments.reportRemainingOptionsAsUnrecognized(); 
    426  
    427     // report any errors if they have occured when parsing the program aguments. 
    428     if (arguments.errors()) 
    429     { 
    430         arguments.writeErrorMessages(std::cout); 
    431         return 1; 
    432     } 
    433      
    434     if (arguments.argc()<=1) 
    435     { 
    436         arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); 
    437         return 1; 
    438     } 
    439  
    440420     
    441421    // load the nodes from the commandline arguments. 
     
    456436    rootNode->addChild(createPreRenderSubGraph(loadedModelTransform,tex_width,tex_height, renderImplementation, useImage, useTextureRectangle, useHDR)); 
    457437 
    458  
    459438    // add model to the viewer. 
    460439    viewer.setSceneData( rootNode ); 
    461440 
    462  
    463     // create the windows and run the threads. 
    464     viewer.realize(); 
    465  
    466     while( !viewer.done() ) 
    467     { 
    468         // wait for all cull and draw threads to complete. 
    469         viewer.sync(); 
    470  
    471         // update the scene by traversing it with the the update visitor which will 
    472         // call all node update callbacks and animations. 
    473         viewer.update(); 
    474           
    475         // fire off the cull and draw traversals of the scene. 
    476         viewer.frame(); 
    477          
    478     } 
    479      
    480     // wait for all cull and draw threads to complete. 
    481     viewer.sync(); 
    482  
    483     // run a clean up frame to delete all OpenGL objects. 
    484     viewer.cleanup_frame(); 
    485  
    486     // wait for all the clean up frame to complete. 
    487     viewer.sync(); 
    488  
    489     return 0; 
     441    return viewer.run(); 
    490442}