Ignore:
Timestamp:
Sep 4, 2011, 9:13:25 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r314 r315  
    1616extViewer::extViewer(osg::ArgumentParser& arguments) : Viewer(arguments)
    1717{
    18 //      setUpViewForManualDistortion(0);
     18
    1919}
    2020
     
    2929}
    3030
    31 void extViewer::setUpViewForManualDistortion(osg::Image* intensityMap, unsigned int screenNum)
     31void extViewer::setUpViewForManualDistortion(unsigned int screenNum, osg::Image* intensityMap, const osg::Matrixd& projectorMatrix)
    3232{
    3333        OSG_INFO<<"View::setUpViewForManualDistortion(sn="<<screenNum<<", im="<<intensityMap<<")"<<std::endl;
     
    9999    {
    100100        osg::ref_ptr<osg::Camera> camera = new osg::Camera;
    101         camera->setName("Scene camera");
     101        camera->setName("Scene cam");
    102102        camera->setGraphicsContext(gc.get());
    103103        camera->setViewport(new osg::Viewport(0,0,camera_width, camera_height));
     
    117117    {
    118118        osg::Geode* geode = new osg::Geode();
    119         //geode->addDrawable(createParoramicSphericalDisplayDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), radius, collar, applyIntensityMapAsColours ? intensityMap : 0, projectorMatrix));
    120                 geode->addDrawable(createMesh(16, 19));
     119                //geode->addDrawable(createParoramicSphericalDisplayDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 1, 0.45, 0, projectorMatrix));
     120                geode->addDrawable(createMesh(160, 190));
    121121
    122122        // new we need to add the texture to the mesh, we do so by creating a
     
    225225
    226226
    227         osg::ComputeBoundsVisitor cbv;
    228         cbv.applyDrawable(geom);
    229         osg::BoundingBox box = cbv.getBoundingBox();
    230         if (!box.valid())
    231                 std::cout << "Invalid bounding box!";
    232         geom->setInitialBound(box);
    233 
    234         osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
     227        //osg::ComputeBoundsVisitor cbv;
     228        //cbv.applyDrawable(geom);
     229        //osg::BoundingBox box = cbv.getBoundingBox();
     230        //if (!box.valid())
     231        //      std::cout << "Invalid bounding box!";
     232        //geom->setInitialBound(box);
     233
     234        /*osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;
    235235        texture->setImage( osgDB::readImageFile("Images/osg256.png") );
    236236        texture->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR_MIPMAP_LINEAR );
    237237        texture->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR_MIPMAP_LINEAR );
    238         geom->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() );
     238        geom->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() );*/
    239239
    240240        // Create normals
    241         osgUtil::SmoothingVisitor::smooth( *geom );
     241        //osgUtil::SmoothingVisitor::smooth( *geom );
    242242
    243243        return geom.release();
  • experimental/distortionNG/extViewer.h

    r313 r315  
    1414
    1515                /** Convenience method for projection on curved screens using a slave camera rendering scene and a second camera doing distortion correction to present on a nonplaner display.*/
    16         void setUpViewForManualDistortion(osg::Image* intensityMap, unsigned int screenNum=0);
     16        void setUpViewForManualDistortion(unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd());
    1717
    1818                static osg::Geometry* createMesh(unsigned int column, unsigned int row);
  • experimental/distortionNG/main.cpp

    r313 r315  
    4141    // construct the viewer.
    4242    extViewer viewer(arguments);
     43        viewer.setUpViewForManualDistortion();
     44
    4345
    4446    // set up the camera manipulators.
     
    104106                        return 1;
    105107                }
     108                else
     109                        viewer.setSceneData( rootnode );
    106110    }
    107111
    108         osg::ref_ptr<osg::Geode> geode = new osg::Geode;
    109         geode->addDrawable( extViewer::createMesh(16, 9) );
    110         geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
    111         geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
     112        //osg::ref_ptr<osg::Geode> geode = new osg::Geode;
     113        //geode->addDrawable( extViewer::createMesh(16, 9) );
     114        //geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
     115        //geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
    112116
    113         osg::ref_ptr<distortionHandler> selector = new distortionHandler( viewer.getCamera() );
     117        //osg::ref_ptr<distortionHandler> selector = new distortionHandler( viewer.getCamera() );
    114118
    115         osg::ref_ptr<osg::Group> root = new osg::Group;
    116         root->addChild( geode.get() );
    117         root->addChild( selector->createVertexHighlighter() );
     119        //osg::ref_ptr<osg::Group> root = new osg::Group;
     120        //root->addChild( geode.get() );
     121        //root->addChild( selector->createVertexHighlighter() );
    118122
    119         viewer.addEventHandler( selector.get() );
    120         viewer.setSceneData( root.get() );
     123        //viewer.addEventHandler( selector.get() );
     124        //viewer.setSceneData( root.get() );
    121125
    122         // Avoid that the highlighter is culled away
    123         osg::CullSettings::CullingMode mode = viewer.getCamera()->getCullingMode();
    124         viewer.getCamera()->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
     126        //// Avoid that the highlighter is culled away
     127        //osg::CullSettings::CullingMode mode = viewer.getCamera()->getCullingMode();
     128        //viewer.getCamera()->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
    125129       
    126130        // run the viewers main loop
Note: See TracChangeset for help on using the changeset viewer.