Changeset 360 for experimental


Ignore:
Timestamp:
Apr 22, 2012, 12:47:07 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/DistortionSet.cpp

    r353 r360  
    2424DistortionSet::DistortionSet()
    2525{
    26         _distortionMeshRows = 1;
    27         _distortionMeshColumns = 1;
     26        _distortionMeshRows = 2;
     27        _distortionMeshColumns = 2;
    2828        //GLenum _meshType;
    2929       
  • experimental/distortionNG/DistortionSet.h

    r357 r360  
    2323#include <osg/Camera>
    2424#include <osg/Switch>
     25#include <osg/Shader>
    2526
    2627namespace osgViewer {
     
    5960
    6061        osg::Switch* getDistortionInternals()   { return _distortionInternals; }
     62
     63
    6164
    6265
  • experimental/distortionNG/extViewer.cpp

    r359 r360  
    255255        stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), texmat, osg::StateAttribute::ON);
    256256
    257                 osg::Geometry* distortionMesh = createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 20, 20, projectorMatrix);
     257                osg::Geometry* distortionMesh = createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), _distortionSet->getDistortionMeshColumns(), _distortionSet->getDistortionMeshColumns(), projectorMatrix);
    258258                meshGeode->addDrawable(distortionMesh);
    259259
     
    333333
    334334        // create shaders for blending
    335         osg::Program* distortProgram = new osg::Program;
    336         distortProgram->setName( "intensityMapBlending" );
     335        osg::Program* IntensityMapProgram = new osg::Program;
     336        IntensityMapProgram->setName( "intensityMapBlending" );
    337337        osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" );
    338338        fShader->setName("intensityMapFragShader");
     
    340340        if ( fShader )
    341341        {
    342                 distortProgram->addShader( fShader );
     342                IntensityMapProgram->addShader( fShader );
    343343                stateset->addUniform( new osg::Uniform("sceneTexture", (int)_distortionSet->getTexUnitScene()) );
    344344                stateset->addUniform( new osg::Uniform("intensityMapTexture", (int)_distortionSet->getTexUnitIntensityMap()) );
    345                 stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
     345                stateset->setAttributeAndModes(IntensityMapProgram, osg::StateAttribute::ON);
    346346        }
    347347}
     
    358358
    359359        // Create DistortionSet
    360         _distortionSet = new osgViewer::DistortionSet();
    361         _distortionSet->setIntensityMap( intMap );
    362         _distortionSet->setDistortionMeshRows( 1 );
    363         _distortionSet->setDistortionMeshColumns( 1 );
    364         _distortionSet->setTexUnitScene( 0 );
    365         _distortionSet->setTexUnitIntensityMap( 1 );
    366 
    367         // Todo: call setupDistortion/Blendung to perform the blending
    368 }
     360        osgViewer::DistortionSet* ds = new osgViewer::DistortionSet();
     361        ds->setIntensityMap( intMap );
     362        ds->setDistortionMeshRows( 2 );
     363        ds->setDistortionMeshColumns( 2 );
     364        ds->setTexUnitScene( 0 );
     365        ds->setTexUnitIntensityMap( 1 );
     366
     367        setUpViewForManualDistortion(ds);
     368}
  • experimental/distortionNG/extViewer.h

    r359 r360  
    3838                /** 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.*/
    3939        void setUpViewForManualDistortion(osgViewer::DistortionSet* distSet, unsigned int screenNum=0, const osg::Matrixd& projectorMatrix = osg::Matrixd());
     40                //void setUpViewForManualDistortion(unsigned int rows, unsigned int colums, std::string intensityMap="");
     41
    4042
    4143                void setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, unsigned int screenNum=0);
  • experimental/distortionNG/main.cpp

    r359 r360  
    5656        viewer.setUpViewForManualDistortion(_distortionSet, 0);
    5757   
    58        
     58        //viewer.setUpIntensityMapBlending("intensitymap.png");
    5959
    6060        // set up the camera manipulators.
     
    195195 *                                                                     
    196196 *
    197  *
     197 * direct to do:
     198 *
     199 * speichern des containers in ein .dist file
     200 * Laden des Containers.
     201 * osgviewer setup fit machen: simple distortion ( nur rows, colums und optional blendmap ist angegeben
     202 * shaderwechsel funktioniert, so dass die reine blendmap angezeigt werden kann.
     203 * reset distortion funktioniert.
     204 * statesetmanipulator muss auf die scene, nicht auf mesh losgehen.
     205 *
     206 * Anwenden der distortion auf die Meshknoten oder die texturekoordinaten
     207 *
     208 * alternativ:
     209 * - umstellung der koordinaten auf [0-1]
     210 * - speichern der hieght und width im container so daß das mesh an andere Bildschirmgrößen angepasst werden kann.
     211 
    198212 *
    199213*/
Note: See TracChangeset for help on using the changeset viewer.