Show
Ignore:
Timestamp:
06/12/07 10:29:32 (8 years ago)
Author:
robert
Message:

Added screen number, and flip support into dome correction codes.

Files:
1 modified

Legend:

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

    r6625 r6935  
    293293    if (arguments.read("--collar", collar_radius)) {} 
    294294 
     295    double rotationDegrees = 180.0; 
     296    if (arguments.read("--rotation", rotationDegrees)) {} 
     297 
    295298    osg::Vec3d center(0.0,0.0,0.0); 
    296299    osg::Vec3d eye(0.0,0.0,0.0); 
     
    331334    osg::Vec3 dy = yAxis*(height/((float)(noSteps-1))); 
    332335     
     336    osg::Vec3 top = origin + yAxis*height; 
     337 
    333338    osg::Vec3d screenCenter = origin + widthVector*0.5f + heightVector*0.5f; 
    334339    float screenRadius = heightVector.length() * 0.5f; 
    335340 
     341    double rotation = osg::DegreesToRadians(rotationDegrees); 
     342 
    336343    osg::Vec3 cursor = bottom; 
    337344    int i,j; 
    338345     
    339346    int midSteps = noSteps/2; 
     347     
     348    bool flip = false; 
     349    if (arguments.read("--flip")) { flip = true; } 
    340350     
    341351    for(i=0;i<midSteps;++i) 
     
    347357            double theta = atan2(delta.x(), -delta.y()); 
    348358            theta += 2*osg::PI; 
     359 
    349360            double phi = osg::PI_2 * delta.length() / screenRadius; 
    350361            if (phi > osg::PI_2) phi = osg::PI_2; 
     
    360371            // osg::notify(osg::NOTICE)<<"cursor = "<<cursor<< " theta = "<<theta<< "phi="<<phi<<" gamma = "<<gamma<<" texcoord="<<texcoord<<std::endl; 
    361372 
    362             vertices->push_back(cursor); 
     373            if (flip) 
     374                vertices->push_back(osg::Vec3(cursor.x(), top.y()-(cursor.y()-origin.y()),cursor.z())); 
     375            else 
     376                vertices->push_back(cursor); 
     377             
    363378            colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); 
    364379            texcoords->push_back(texcoord); 
     
    384399            // osg::notify(osg::NOTICE)<<"cursor = "<<cursor<< " theta = "<<theta<< "phi="<<phi<<" gamma = "<<gamma<<" texcoord="<<texcoord<<std::endl; 
    385400 
    386             vertices->push_back(cursor); 
     401            if (flip) 
     402                vertices->push_back(osg::Vec3(cursor.x(), top.y()-(cursor.y()-origin.y()),cursor.z())); 
     403            else 
     404                vertices->push_back(cursor); 
     405 
    387406            colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); 
    388407            texcoords->push_back(texcoord); 
     
    414433            // osg::notify(osg::NOTICE)<<"cursor = "<<cursor<< " theta = "<<theta<< "phi="<<phi<<" gamma = "<<gamma<<" texcoord="<<texcoord<<std::endl; 
    415434 
    416             vertices->push_back(cursor); 
     435            if (flip) 
     436                vertices->push_back(osg::Vec3(cursor.x(), top.y()-(cursor.y()-origin.y()),cursor.z())); 
     437            else 
     438                vertices->push_back(cursor); 
     439 
    417440            colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); 
    418441            texcoords->push_back(texcoord); 
     
    459482    } 
    460483 
     484    unsigned int screenNum = 0; 
     485    while (arguments.read("--screen",screenNum)) {} 
     486 
     487 
    461488    unsigned int width, height; 
    462     wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height); 
     489    wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(screenNum), width, height); 
    463490 
    464491    while (arguments.read("--width",width)) {} 
     
    466493 
    467494    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; 
     495    traits->screenNum = screenNum; 
    468496    traits->x = 0; 
    469497    traits->y = 0;