Ignore:
Timestamp:
Mar 3, 2012, 1:22:05 AM (12 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r328 r329  
    11#include "extViewer.h"
    2 
     2#include "distortionNG.h"
     3
     4#include <osg/PolygonOffset>
    35#include<osg/Texture2D>
    46#include<osg/TextureRectangle>
     
    131133        osg::Geode* geode = new osg::Geode();
    132134                //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));
    133                 geode->addDrawable(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));
     135                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);
     136                geode->addDrawable(distortionMesh);
    134137
    135138        // new we need to add the texture to the mesh, we do so by creating a
     
    165168
    166169        // add subgraph to render
    167         camera->addChild(geode);
     170        //camera->addChild(geode);
     171
     172                // selector
     173                geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
     174                geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
     175                osg::ref_ptr<distortionHandler> selector = new distortionHandler( camera, distortionMesh );
     176                osg::ref_ptr<osg::Group> root = new osg::Group;
     177                root->addChild(geode);
     178                root->addChild(selector->createVertexHighlighter());
     179                addEventHandler( selector.get() );
     180                camera->addChild(root);
     181                // Avoid that the highlighter is culled away
     182                osg::CullSettings::CullingMode mode = camera->getCullingMode();
     183                camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
     184
    168185
    169186        camera->setName("Dist Cam");
Note: See TracChangeset for help on using the changeset viewer.