Ignore:
Timestamp:
Apr 17, 2012, 10:55:16 PM (12 years ago)
Author:
Torben Dannhauer
Message:

first draft of the complete distortion framework.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r341 r342  
    2020extViewer::extViewer(osg::ArgumentParser& arguments) : Viewer(arguments)
    2121{
    22 
     22        // Add help for command-line options read here
     23    arguments.getApplicationUsage()->addCommandLineOption("--distort","load distortion file and set up geometrical distortion for viewer. This includes blending");
     24    arguments.getApplicationUsage()->addCommandLineOption("--blend","Set up viewer vor simple blending CullDrawThreadPerContext threading model for viewer.");
    2325}
    2426
     
    3335}
    3436
    35 static osg::Texture2D* loadTexture( const std::string& fileName )
    36 {
    37     std::string foundFileName = osgDB::findDataFile(fileName);
    38     if (foundFileName.length() != 0 )
    39     {
    40         // load distortion map texture file
    41         osg::Image* image = osgDB::readImageFile(foundFileName);
    42         if (image)
    43         {
    44                         osg::Texture2D* texture = new osg::Texture2D;
    45             texture->setImage(image);
    46                         texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
    47                         texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
    48                         texture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);
    49                         texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
    50             return texture;
    51         }
    52     }
    53 
    54     OSG_NOTIFY(osg::WARN) << "File \"" << fileName << "\" not found." << std::endl;
    55 
    56     return NULL;
    57 }
    58 
    59 static osg::TextureRectangle* loadTextureRect( const std::string& fileName )
    60 {
    61     std::string foundFileName = osgDB::findDataFile(fileName);
    62     if (foundFileName.length() != 0 )
    63     {
    64         // load distortion map texture file
    65         osg::Image* image = osgDB::readImageFile(foundFileName);
    66         if (image)
    67         {
    68                         osg::TextureRectangle* texture = new osg::TextureRectangle;
    69             texture->setImage(image);
    70             texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
    71             texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
    72             texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE);
    73             texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE);
    74             return texture;
    75         }
    76     }
    77 
    78     OSG_NOTIFY(osg::WARN) << "File \"" << fileName << "\" not found." << std::endl;
    79 
    80     return NULL;
    81 }
     37//static osg::Texture2D* loadTexture( const std::string& fileName )
     38//{
     39//    std::string foundFileName = osgDB::findDataFile(fileName);
     40//    if (foundFileName.length() != 0 )
     41//    {
     42//        // load distortion map texture file
     43//        osg::Image* image = osgDB::readImageFile(foundFileName);
     44//        if (image)
     45//        {
     46//                      osg::Texture2D* texture = new osg::Texture2D;
     47//            texture->setImage(image);
     48//                      texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
     49//                      texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
     50//                      texture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);
     51//                      texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
     52//            return texture;
     53//        }
     54//    }
     55//
     56//    OSG_NOTIFY(osg::WARN) << "File \"" << fileName << "\" not found." << std::endl;
     57//
     58//    return NULL;
     59//}
     60
     61//static osg::TextureRectangle* loadTextureRect( const std::string& fileName )
     62//{
     63//    std::string foundFileName = osgDB::findDataFile(fileName);
     64//    if (foundFileName.length() != 0 )
     65//    {
     66//        // load distortion map texture file
     67//        osg::Image* image = osgDB::readImageFile(foundFileName);
     68//        if (image)
     69//        {
     70//                      osg::TextureRectangle* texture = new osg::TextureRectangle;
     71//            texture->setImage(image);
     72//            texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
     73//            texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
     74//            texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE);
     75//            texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE);
     76//            return texture;
     77//        }
     78//    }
     79//
     80//    OSG_NOTIFY(osg::WARN) << "File \"" << fileName << "\" not found." << std::endl;
     81//
     82//    return NULL;
     83//}
    8284
    8385static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, osg::Image* intensityMap, bool applyIntensityMapAsColours, const osg::Matrix& projectorMatrix)
Note: See TracChangeset for help on using the changeset viewer.