Show
Ignore:
Timestamp:
09/21/07 11:02:03 (7 years ago)
Author:
robert
Message:

From Luc Frauciel, "A few improvements to osgstereoimage:
- When using a large numbrer of files, the command line was too long;
Added a -files option that allow to store filenames in a file (one file
per line)
- Added some more intuitive key bindings for controls (left, right, + ,
-)
- Set the texture wrapping to CLAMP_TO_EDGE (it's cleaner now)
"

Files:
1 modified

Legend:

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

    r7228 r7446  
    4646    texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR); 
    4747    texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); 
     48    texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER); 
     49    texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER); 
    4850    texture->setResizeNonPowerOfTwoHint(false); 
    4951    texture->setImage(image); 
     
    278280                return true; 
    279281            } 
    280             else if (ea.getKey()=='n') 
     282            else if ((ea.getKey()=='n') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Right))  
    281283            { 
    282284                nextSlide(); 
    283285                return true; 
    284286            } 
    285             else if (ea.getKey()=='p') 
     287            else if ((ea.getKey()=='p') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Left))  
    286288            { 
    287289                previousSlide(); 
    288290                return true; 
    289291            } 
    290             else if (ea.getKey()=='w') 
     292            else if ((ea.getKey()=='w') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Add))  
    291293            { 
    292294                scaleImage(0.99f); 
    293295                return true; 
    294296            } 
    295             else if (ea.getKey()=='s') 
     297            else if ((ea.getKey()=='s') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Subtract))  
    296298            { 
    297299                scaleImage(1.01f); 
     
    463465    arguments.getApplicationUsage()->addCommandLineOption("-y <float>","Vertical offset of left and right images."); 
    464466    arguments.getApplicationUsage()->addCommandLineOption("--disk","Keep images on disk"); 
     467    arguments.getApplicationUsage()->addCommandLineOption("-files <filename>","Load filenames from a file"); 
    465468    arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    466469    arguments.getApplicationUsage()->addCommandLineOption("--SingleThreaded","Select SingleThreaded threading model for viewer."); 
     
    493496    while (arguments.read("--disk")) { onDisk=true;} 
    494497 
     498    std::string filename=""; 
     499    FileList fileList; 
     500    // extract the filenames from the a file, one filename per line. 
     501    while (arguments.read("-files",filename)) { 
     502        std::ifstream is(filename.c_str()); 
     503        if (is) { 
     504                std::string line; 
     505                while (std::getline(is,line,'\n')) fileList.push_back(line); 
     506                is.close(); 
     507            } 
     508     
     509    } 
     510 
    495511    // if user request help write it out to cout. 
    496512    if (arguments.read("-h") || arguments.read("--help")) 
     
    519535     
    520536    // extract the filenames from the arguments list. 
    521     FileList fileList; 
    522537    for(int pos=1;pos<arguments.argc();++pos) 
    523538    {