Ignore:
Timestamp:
Apr 21, 2012, 9:49:26 PM (12 years ago)
Author:
Torben Dannhauer
Message:

DistortionManipulator? is working (alpha stadium)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r352 r353  
    2020#include "distortionNG.h"
    2121
     22#include <osg/Switch>
    2223#include <osg/PolygonOffset>
    2324#include <osg/Texture2D>
     
    273274        camera->setViewMatrix(osg::Matrix::identity());
    274275
    275                 osg::ref_ptr<osg::Group> root = new osg::Group;
    276                 root->addChild(geode);  // add mesh to root so camera renders mesh (and  thus render the scene)
     276                osg::ref_ptr<osg::Switch> root = _distortionSet->getDistortionInternals();
     277                root->addChild(geode, true);    // adds mesh,shader,.. so camera renders mesh (and  thus render the scene)
    277278                camera->addChild(root);
    278279
    279                 // selector
    280                 //geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
    281                 //geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
    282                 //osg::ref_ptr<distortionHandler> selectorHandler = new distortionHandler( camera, distortionMesh );
    283                 //osg::Geode* selectorHighlighter = selectorHandler->createVertexHighlighter();
    284                 //selectorHighlighter->setCullingActive(false); // disable the culling for the selector, otherwise the selector is culled away on the edge.
    285                 //root->addChild(selectorHighlighter);
    286                 //addEventHandler( selectorHandler.get() );// should be in main.cpp
     280                _distortionSet->setDistortionCamera( camera );
     281
     282                // Ensure selector is visible:
     283                geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
     284                geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );
    287285               
    288                 //// Avoid that the highlighter is culled away
    289                 //osg::CullSettings::CullingMode mode = camera->getCullingMode();
    290                 //camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );
    291 
    292286        camera->setName("Dist Cam");
    293287
Note: See TracChangeset for help on using the changeset viewer.