Show
Ignore:
Timestamp:
01/26/10 15:57:44 (4 years ago)
Author:
robert
Message:

Removal of redundant spaces at ends of lines

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgViewer/View.cpp

    r10764 r10999  
    1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield  
     1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 
    22 * 
    3  * This library is open source and may be redistributed and/or modified under   
    4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or  
     3 * This library is open source and may be redistributed and/or modified under 
     4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
    55 * (at your option) any later version.  The full license is in LICENSE file 
    66 * included with this distribution, and on the openscenegraph.org website. 
    7  *  
     7 * 
    88 * This library is distributed in the hope that it will be useful, 
    99 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
     10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1111 * OpenSceneGraph Public License for more details. 
    1212*/ 
     
    3737    CollectedCoordinateSystemNodesVisitor(): 
    3838        NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) {} 
    39          
     39 
    4040    META_NodeVisitor("osgViewer","CollectedCoordinateSystemNodesVisitor") 
    4141 
     
    6060        traverse(node); 
    6161    } 
    62      
     62 
    6363    osg::NodePath _pathToCoordinateSystemNode; 
    6464}; 
     
    7272    ViewerCoordinateFrameCallback(osgViewer::View* view): 
    7373        _view(view) {} 
    74      
     74 
    7575    virtual osg::CoordinateFrame getCoordinateFrame(const osg::Vec3d& position) const 
    7676    { 
     
    7878 
    7979        osg::NodePath tmpPath = _view->getCoordinateSystemNodePath(); 
    80          
     80 
    8181        if (!tmpPath.empty()) 
    82         {         
     82        { 
    8383            osg::Matrixd coordinateFrame; 
    8484 
     
    8787            { 
    8888                osg::Vec3 local_position = position*osg::computeWorldToLocal(tmpPath); 
    89                  
     89 
    9090                // get the coordinate frame in world coords. 
    9191                coordinateFrame = csn->computeLocalCoordinateFrame(local_position)* osg::computeLocalToWorld(tmpPath); 
     
    122122        } 
    123123    } 
    124      
     124 
    125125protected: 
    126126    virtual ~ViewerCoordinateFrameCallback() {} 
    127      
     127 
    128128    osg::observer_ptr<osgViewer::View> _view; 
    129129}; 
     
    147147    // make sure View is safe to reference multi-threaded. 
    148148    setThreadSafeRefUnref(true); 
    149      
     149 
    150150    // need to attach a Renderer to the master camera which has been default constructed 
    151151    getCamera()->setRenderer(createRenderer(getCamera())); 
    152152 
    153153    setEventQueue(new osgGA::EventQueue); 
    154      
     154 
    155155    setStats(new osg::Stats("View")); 
    156156} 
     
    183183 
    184184#if 1 
    185     osgViewer::View* rhs_osgViewer = dynamic_cast<osgViewer::View*>(&rhs);     
     185    osgViewer::View* rhs_osgViewer = dynamic_cast<osgViewer::View*>(&rhs); 
    186186    if (rhs_osgViewer) 
    187187    { 
    188      
     188 
    189189        // copy across rhs 
    190190        _startTick = rhs_osgViewer->_startTick; 
     
    195195            _scene = rhs_osgViewer->_scene; 
    196196        } 
    197          
     197 
    198198        if (rhs_osgViewer->_cameraManipulator.valid()) 
    199199        { 
    200200            _cameraManipulator = rhs_osgViewer->_cameraManipulator; 
    201201        } 
    202          
     202 
    203203        _eventHandlers.insert(_eventHandlers.end(), rhs_osgViewer->_eventHandlers.begin(), rhs_osgViewer->_eventHandlers.end()); 
    204204 
     
    208208        _fusionDistanceMode = rhs_osgViewer->_fusionDistanceMode; 
    209209        _fusionDistanceValue = rhs_osgViewer->_fusionDistanceValue; 
    210          
    211          
     210 
     211 
    212212        // clear rhs 
    213213        rhs_osgViewer->_frameStamp = 0; 
     
    215215        rhs_osgViewer->_cameraManipulator = 0; 
    216216        rhs_osgViewer->_eventHandlers.clear(); 
    217          
     217 
    218218        rhs_osgViewer->_coordinateSystemNodePath.clear(); 
    219          
     219 
    220220        rhs_osgViewer->_displaySettings = 0; 
    221221    } 
     
    236236{ 
    237237    osg::notify(osg::INFO)<<"View::init()"<<std::endl; 
    238      
     238 
    239239    osg::ref_ptr<osgGA::GUIEventAdapter> initEvent = _eventQueue->createEvent(); 
    240240    initEvent->setEventType(osgGA::GUIEventAdapter::FRAME); 
    241      
     241 
    242242    if (_cameraManipulator.valid()) 
    243243    { 
     
    290290        osgUtil::Optimizer::StaticObjectDetectionVisitor sodv; 
    291291        getSceneData()->accept(sodv); 
    292          
     292 
    293293        // make sure that existing scene graph objects are allocated with thread safe ref/unref 
    294         if (getViewerBase() &&  
    295             getViewerBase()->getThreadingModel()!=ViewerBase::SingleThreaded)  
     294        if (getViewerBase() && 
     295            getViewerBase()->getThreadingModel()!=ViewerBase::SingleThreaded) 
    296296        { 
    297297            getSceneData()->setThreadSafeRefUnref(true); 
    298298        } 
    299          
     299 
    300300        // update the scene graph so that it has enough GL object buffer memory for the graphics contexts that will be using it. 
    301301        getSceneData()->resizeGLObjectBuffers(osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts()); 
    302302    } 
    303      
     303 
    304304    computeActiveCoordinateSystemNodePath(); 
    305305 
     
    342342{ 
    343343    _cameraManipulator = manipulator; 
    344      
     344 
    345345    if (_cameraManipulator.valid()) 
    346346    { 
     
    348348 
    349349        if (getSceneData()) _cameraManipulator->setNode(getSceneData()); 
    350          
     350 
    351351        osg::ref_ptr<osgGA::GUIEventAdapter> dummyEvent = _eventQueue->createEvent(); 
    352352 
     
    407407    // now search for CoordinateSystemNode's for which we want to track. 
    408408    osg::Node* subgraph = getSceneData(); 
    409      
     409 
    410410    if (subgraph) 
    411411    { 
    412      
     412 
    413413        CollectedCoordinateSystemNodesVisitor ccsnv; 
    414414        subgraph->accept(ccsnv); 
     
    419419           return; 
    420420        } 
    421     }   
     421    } 
    422422 
    423423    // otherwise no node path found so reset to empty. 
     
    428428{ 
    429429    osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); 
    430     if (!wsi)  
     430    if (!wsi) 
    431431    { 
    432432        osg::notify(osg::NOTICE)<<"View::setUpViewAcrossAllScreens() : Error, no WindowSystemInterface available, cannot create windows."<<std::endl; 
    433433        return; 
    434434    } 
    435      
     435 
    436436    osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance(); 
    437      
    438     double fovy, aspectRatio, zNear, zFar;         
     437 
     438    double fovy, aspectRatio, zNear, zFar; 
    439439    _camera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar); 
    440440 
    441441    osg::GraphicsContext::ScreenIdentifier si; 
    442442    si.readDISPLAY(); 
    443      
     443 
    444444    // displayNum has not been set so reset it to 0. 
    445445    if (si.displayNum<0) si.displayNum = 0; 
    446      
     446 
    447447    unsigned int numScreens = wsi->getNumScreens(si); 
    448448    if (numScreens==1) 
    449449    { 
    450450        if (si.screenNum<0) si.screenNum = 0; 
    451      
     451 
    452452        unsigned int width, height; 
    453453        wsi->getScreenResolution(si, width, height); 
     
    468468 
    469469        _camera->setGraphicsContext(gc.get()); 
    470          
     470 
    471471        osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get()); 
    472472        if (gw) 
     
    508508            translate_x += double(width) / (double(height) * aspectRatio); 
    509509        } 
    510          
     510 
    511511        bool stereoSlitScreens = numScreens==2 && 
    512512                                 ds->getStereoMode()==osg::DisplaySettings::HORIZONTAL_SPLIT && 
    513513                                 ds->getStereo(); 
    514      
     514 
    515515        for(unsigned int i=0; i<numScreens; ++i) 
    516516        { 
    517517            si.screenNum = i; 
    518          
     518 
    519519            unsigned int width, height; 
    520520            wsi->getScreenResolution(si, width, height); 
     
    559559            { 
    560560                unsigned int leftCameraNum = (ds->getSplitStereoHorizontalEyeMapping()==osg::DisplaySettings::LEFT_EYE_LEFT_VIEWPORT) ? 0 : 1; 
    561                  
     561 
    562562                osg::ref_ptr<osg::DisplaySettings> ds_local = new osg::DisplaySettings(*ds); 
    563563                ds_local->setStereoMode(leftCameraNum==i ? osg::DisplaySettings::LEFT_EYE : osg::DisplaySettings::RIGHT_EYE); 
    564564                camera->setDisplaySettings(ds_local.get()); 
    565                  
     565 
    566566                addSlave(camera.get(), osg::Matrixd(), osg::Matrixd() ); 
    567567            } 
     
    588588    traits->readDISPLAY(); 
    589589    if (traits->displayNum<0) traits->displayNum = 0; 
    590      
     590 
    591591    traits->screenNum = screenNum; 
    592592    traits->x = x; 
     
    613613    } 
    614614 
    615     double fovy, aspectRatio, zNear, zFar;         
     615    double fovy, aspectRatio, zNear, zFar; 
    616616    _camera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar); 
    617617 
     
    634634{ 
    635635    osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); 
    636     if (!wsi)  
     636    if (!wsi) 
    637637    { 
    638638        osg::notify(osg::NOTICE)<<"View::setUpViewOnSingleScreen() : Error, no WindowSystemInterface available, cannot create windows."<<std::endl; 
     
    644644    osg::GraphicsContext::ScreenIdentifier si; 
    645645    si.readDISPLAY(); 
    646      
     646 
    647647    // displayNum has not been set so reset it to 0. 
    648648    if (si.displayNum<0) si.displayNum = 0; 
     
    680680    } 
    681681 
    682     double fovy, aspectRatio, zNear, zFar;         
     682    double fovy, aspectRatio, zNear, zFar; 
    683683    _camera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar); 
    684684 
     
    702702    osg::Vec3d center(0.0,0.0,0.0); 
    703703    osg::Vec3d eye(0.0,0.0,0.0); 
    704      
     704 
    705705    double distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius); 
    706      
     706 
    707707    bool centerProjection = false; 
    708708 
    709709    osg::Vec3d projector = eye - osg::Vec3d(0.0,0.0, distance); 
    710      
     710 
    711711    osg::notify(osg::INFO)<<"create3DSphericalDisplayDistortionMesh : Projector position = "<<projector<<std::endl; 
    712712    osg::notify(osg::INFO)<<"create3DSphericalDisplayDistortionMesh : distance = "<<distance<<std::endl; 
     
    725725    float height = heightVector.length(); 
    726726    yAxis /= height; 
    727      
     727 
    728728    int noSteps = 50; 
    729729 
     
    736736    osg::Vec3 dx = xAxis*(width/((float)(noSteps-1))); 
    737737    osg::Vec3 dy = yAxis*(height/((float)(noSteps-1))); 
    738      
     738 
    739739    osg::Vec3d screenCenter = origin + widthVector*0.5f + heightVector*0.5f; 
    740740    float screenRadius = heightVector.length() * 0.5f; 
     
    756756 
    757757                phi *= 2.0; 
    758                  
     758 
    759759                if (theta<0.0) theta += 2.0*osg::PI; 
    760760 
     
    770770                osg::Vec2 texcoord1(theta/(2.0*osg::PI), 1.0f - phi/osg::PI_2); 
    771771                if (intensityMap) 
    772                 {             
     772                { 
    773773                    colors->push_back(intensityMap->getColor(texcoord1)); 
    774774                } 
     
    798798 
    799799                // osg::notify(osg::NOTICE)<<"theta = "<<theta<< "phi="<<phi<<std::endl; 
    800                  
     800 
    801801                double f = distance * sin(phi); 
    802802                double e = distance * cos(phi) + sqrt( sphere_radius*sphere_radius - f*f); 
     
    804804                double h = e * sin(phi); 
    805805                double z = l - distance; 
    806                  
     806 
    807807                osg::Vec3 texcoord(h * cos(theta) / sphere_radius, 
    808808                                   h * sin(theta) / sphere_radius, 
     
    814814                osg::Vec2 texcoord1(theta/(2.0*osg::PI), 1.0f - phi/osg::PI_2); 
    815815                if (intensityMap) 
    816                 {             
     816                { 
    817817                    colors->push_back(intensityMap->getColor(texcoord1)); 
    818818                } 
     
    828828        } 
    829829    } 
    830      
     830 
    831831    // pass the created vertex array to the points geometry object. 
    832832    geometry->setVertexArray(vertices); 
     
    848848        geometry->addPrimitiveSet(elements); 
    849849    } 
    850      
     850 
    851851    return geometry; 
    852852} 
     
    856856    osg::notify(osg::INFO)<<"View::setUpViewFor3DSphericalDisplay(rad="<<radius<<", cllr="<<collar<<", sn="<<screenNum<<", im="<<intensityMap<<")"<<std::endl; 
    857857    osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); 
    858     if (!wsi)  
     858    if (!wsi) 
    859859    { 
    860860        osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl; 
     
    864864    osg::GraphicsContext::ScreenIdentifier si; 
    865865    si.readDISPLAY(); 
    866      
     866 
    867867    // displayNum has not been set so reset it to 0. 
    868868    if (si.displayNum<0) si.displayNum = 0; 
     
    885885    traits->doubleBuffer = true; 
    886886    traits->sharedContext = 0; 
    887      
     887 
    888888 
    889889    osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); 
     
    893893        return; 
    894894    } 
    895      
     895 
    896896    bool applyIntensityMapAsColours = true; 
    897897 
     
    911911    texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE); 
    912912    texture->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE); 
    913      
    914 #if 0     
     913 
     914#if 0 
    915915    osg::Camera::RenderTargetImplementation renderTargetImplementation = osg::Camera::SEPERATE_WINDOW; 
    916916    GLenum buffer = GL_FRONT; 
     
    938938    } 
    939939 
    940      
     940 
    941941    // top face 
    942942    { 
     
    10341034        addSlave(camera.get(), osg::Matrixd(), osg::Matrixd::rotate(osg::inDegrees(180.0f), 1.0,0.0,0.0)); 
    10351035    } 
    1036      
     1036 
    10371037    getCamera()->setProjectionMatrixAsPerspective(90.0f, 1.0, 1, 1000.0); 
    10381038 
     
    10421042        geode->addDrawable(create3DSphericalDisplayDistortionMesh(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)); 
    10431043 
    1044         // new we need to add the texture to the mesh, we do so by creating a  
     1044        // new we need to add the texture to the mesh, we do so by creating a 
    10451045        // StateSet to contain the Texture StateAttribute. 
    10461046        osg::StateSet* stateset = geode->getOrCreateStateSet(); 
     
    10651065        camera->setInheritanceMask(camera->getInheritanceMask() & ~osg::CullSettings::CLEAR_COLOR & ~osg::CullSettings::COMPUTE_NEAR_FAR_MODE); 
    10661066        //camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); 
    1067          
     1067 
    10681068        camera->setProjectionMatrixAsOrtho2D(0,width,0,height); 
    10691069        camera->setViewMatrix(osg::Matrix::identity()); 
     
    10711071        // add subgraph to render 
    10721072        camera->addChild(geode); 
    1073          
     1073 
    10741074        camera->setName("DistortionCorrectionCamera"); 
    10751075 
    10761076        addSlave(camera.get(), osg::Matrixd(), osg::Matrixd(), false); 
    10771077    } 
    1078      
     1078 
    10791079    getCamera()->setNearFarRatio(0.0001f); 
    1080      
     1080 
    10811081    if (getLightingMode()==osg::View::HEADLIGHT) 
    10821082    { 
     
    10901090    osg::Vec3d center(0.0,0.0,0.0); 
    10911091    osg::Vec3d eye(0.0,0.0,0.0); 
    1092      
     1092 
    10931093    double distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius); 
    10941094    bool flip = false; 
     
    10961096 
    10971097    osg::Vec3d projector = eye - osg::Vec3d(0.0,0.0, distance); 
    1098      
    1099      
     1098 
     1099 
    11001100    osg::notify(osg::INFO)<<"createParoramicSphericalDisplayDistortionMesh : Projector position = "<<projector<<std::endl; 
    11011101    osg::notify(osg::INFO)<<"createParoramicSphericalDisplayDistortionMesh : distance = "<<distance<<std::endl; 
     
    11131113    float height = heightVector.length(); 
    11141114    yAxis /= height; 
    1115      
     1115 
    11161116    int noSteps = 160; 
    11171117 
     
    11241124    osg::Vec3 dx = xAxis*(width/((float)(noSteps-2))); 
    11251125    osg::Vec3 dy = yAxis*(height/((float)(noSteps-1))); 
    1126      
     1126 
    11271127    osg::Vec3 top = origin + yAxis*height; 
    11281128 
    11291129    osg::Vec3 screenCenter = origin + widthVector*0.5f + heightVector*0.5f; 
    11301130    float screenRadius = heightVector.length() * 0.5f; 
    1131      
     1131 
    11321132    geometry->getOrCreateStateSet()->setMode(GL_CULL_FACE, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED); 
    11331133 
     
    11401140            double theta = texcoord.x() * 2.0 * osg::PI; 
    11411141            double phi = (1.0-texcoord.y()) * osg::PI; 
    1142              
     1142 
    11431143            if (texcoord_flip) texcoord.y() = 1.0f - texcoord.y(); 
    11441144 
    11451145            osg::Vec3 pos(sin(phi)*sin(theta), sin(phi)*cos(theta), cos(phi)); 
    11461146            pos = pos*projectorMatrix; 
    1147              
     1147 
    11481148            double alpha = atan2(pos.x(), pos.y()); 
    11491149            if (alpha<0.0) alpha += 2.0*osg::PI; 
    1150              
     1150 
    11511151            double beta = atan2(sqrt(pos.x()*pos.x() + pos.y()*pos.y()), pos.z()); 
    11521152            if (beta<0.0) beta += 2.0*osg::PI; 
     
    11541154            double gamma = atan2(sqrt(double(pos.x()*pos.x() + pos.y()*pos.y())), double(pos.z()+distance)); 
    11551155            if (gamma<0.0) gamma += 2.0*osg::PI; 
    1156              
    1157              
     1156 
     1157 
    11581158            osg::Vec3 v = screenCenter + osg::Vec3(sin(alpha)*gamma*2.0/osg::PI, -cos(alpha)*gamma*2.0/osg::PI, 0.0f)*screenRadius; 
    1159               
     1159 
    11601160            if (flip) 
    11611161                vertices->push_back(osg::Vec3(v.x(), top.y()-(v.y()-origin.y()),v.z())); 
     
    11641164 
    11651165            texcoords0->push_back( texcoord ); 
    1166          
     1166 
    11671167            osg::Vec2 texcoord1(alpha/(2.0*osg::PI), 1.0f - beta/osg::PI); 
    11681168            if (intensityMap) 
     
    12011201            int i3 = j+1+(i)*noSteps; 
    12021202            int i4 = j+1+(i+1)*noSteps; 
    1203              
     1203 
    12041204            osg::Vec3& v1 = (*vertices)[i1]; 
    12051205            osg::Vec3& v2 = (*vertices)[i2]; 
     
    12111211            if ((v3-screenCenter).length()>screenRadius) continue; 
    12121212            if ((v4-screenCenter).length()>screenRadius) continue; 
    1213              
     1213 
    12141214            elements->push_back(i1); 
    12151215            elements->push_back(i2); 
    12161216            elements->push_back(i3); 
    1217              
     1217 
    12181218            elements->push_back(i1); 
    12191219            elements->push_back(i3); 
     
    12211221        } 
    12221222    } 
    1223     
     1223 
    12241224    return geometry; 
    12251225} 
     
    12301230 
    12311231    osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); 
    1232     if (!wsi)  
     1232    if (!wsi) 
    12331233    { 
    12341234        osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl; 
     
    12381238    osg::GraphicsContext::ScreenIdentifier si; 
    12391239    si.readDISPLAY(); 
    1240      
     1240 
    12411241    // displayNum has not been set so reset it to 0. 
    12421242    if (si.displayNum<0) si.displayNum = 0; 
     
    12581258    traits->doubleBuffer = true; 
    12591259    traits->sharedContext = 0; 
    1260      
     1260 
    12611261 
    12621262    bool applyIntensityMapAsColours = true; 
     
    12831283    texture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE); 
    12841284    texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE); 
    1285      
    1286 #if 0     
     1285 
     1286#if 0 
    12871287    osg::Camera::RenderTargetImplementation renderTargetImplementation = osg::Camera::SEPERATE_WINDOW; 
    12881288    GLenum buffer = GL_FRONT; 
     
    13151315        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)); 
    13161316 
    1317         // new we need to add the texture to the mesh, we do so by creating a  
     1317        // new we need to add the texture to the mesh, we do so by creating a 
    13181318        // StateSet to contain the Texture StateAttribute. 
    13191319        osg::StateSet* stateset = geode->getOrCreateStateSet(); 
     
    13421342        camera->setInheritanceMask(camera->getInheritanceMask() & ~osg::CullSettings::CLEAR_COLOR & ~osg::CullSettings::COMPUTE_NEAR_FAR_MODE); 
    13431343        //camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); 
    1344          
     1344 
    13451345        camera->setProjectionMatrixAsOrtho2D(0,width,0,height); 
    13461346        camera->setViewMatrix(osg::Matrix::identity()); 
     
    13481348        // add subgraph to render 
    13491349        camera->addChild(geode); 
    1350          
     1350 
    13511351        camera->setName("DistortionCorrectionCamera"); 
    13521352 
     
    13601360 
    13611361    osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); 
    1362     if (!wsi)  
     1362    if (!wsi) 
    13631363    { 
    13641364        osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl; 
     
    13681368    osg::GraphicsContext::ScreenIdentifier si; 
    13691369    si.readDISPLAY(); 
    1370      
     1370 
    13711371    // displayNum has not been set so reset it to 0. 
    13721372    if (si.displayNum<0) si.displayNum = 0; 
    1373      
     1373 
    13741374    si.screenNum = screenNum; 
    13751375 
     
    13881388    traits->doubleBuffer = true; 
    13891389    traits->sharedContext = 0; 
    1390      
     1390 
    13911391 
    13921392    osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); 
     
    14151415    textureD->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR); 
    14161416 
    1417 #if 0     
     1417#if 0 
    14181418    osg::Camera::RenderTargetImplementation renderTargetImplementation = osg::Camera::SEPERATE_WINDOW; 
    14191419    GLenum buffer = GL_FRONT; 
     
    14821482                for (int x=0; x<=9; ++x){ 
    14831483                    for (int y=7; y>=0; --y){ 
    1484                         int i = 2*(7-y)+16*x;             
     1484                        int i = 2*(7-y)+16*x; 
    14851485                        cheader[i] = (((1<<(y))&(header[x])) << (7-(y))); 
    14861486                    } 
    14871487                } 
    1488             }             
     1488            } 
    14891489            textureHeader->setImage(imageheader.get()); 
    14901490        } 
     
    15311531            stateset->addUniform(new osg::Uniform("wow_tcolor", 1)); 
    15321532            stateset->addUniform(new osg::Uniform("wow_tdepth", 2)); 
    1533              
     1533 
    15341534            osg::Shader *frag = new osg::Shader(osg::Shader::FRAGMENT); 
    15351535            frag->setShaderSource(" "\ 
     
    15891589            camera->setInheritanceMask(camera->getInheritanceMask() & ~osg::CullSettings::CLEAR_COLOR & ~osg::CullSettings::COMPUTE_NEAR_FAR_MODE); 
    15901590            //camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR); 
    1591              
     1591 
    15921592            camera->setProjectionMatrixAsOrtho2D(0,width,0,height); 
    15931593            camera->setViewMatrix(osg::Matrix::identity()); 
     
    15951595            // add subgraph to render 
    15961596            camera->addChild(geode); 
    1597              
     1597 
    15981598            camera->setName("WoWCamera"); 
    15991599 
     
    16101610 
    16111611    osg::Node* sceneData = _scene.valid() ? _scene->getSceneData() : 0; 
    1612      
     1612 
    16131613    if (_cameraManipulator.valid()) 
    16141614    { 
    16151615        _cameraManipulator->setNode(sceneData); 
    1616          
     1616 
    16171617        osg::ref_ptr<osgGA::GUIEventAdapter> dummyEvent = _eventQueue->createEvent(); 
    16181618 
     
    16241624        _camera->removeChildren(0,_camera->getNumChildren()); 
    16251625        if (sceneData) _camera->addChild(sceneData); 
    1626          
     1626 
    16271627        Renderer* renderer = dynamic_cast<Renderer*>(_camera->getRenderer()); 
    16281628        if (renderer) renderer->setCompileOnNextDraw(true); 
     
    16371637            slave._camera->removeChildren(0,slave._camera->getNumChildren()); 
    16381638            if (sceneData) slave._camera->addChild(sceneData); 
    1639          
     1639 
    16401640            Renderer* renderer = dynamic_cast<Renderer*>(slave._camera->getRenderer()); 
    16411641            if (renderer) renderer->setCompileOnNextDraw(true); 
    16421642        } 
    1643     }     
     1643    } 
    16441644} 
    16451645 
     
    16711671{ 
    16721672    osg::notify(osg::INFO)<<"View::requestWarpPointer("<<x<<","<<y<<")"<<std::endl; 
    1673      
     1673 
    16741674    float local_x, local_y; 
    16751675    const osg::Camera* camera = getCameraContainingPosition(x, y, local_x, local_y); 
     
    16971697{ 
    16981698    if (_camera == camera) return true; 
    1699      
     1699 
    17001700    for(unsigned i=0; i<getNumSlaves(); ++i) 
    17011701    { 
     
    17081708const osg::Camera* View::getCameraContainingPosition(float x, float y, float& local_x, float& local_y) const 
    17091709{ 
    1710     const osgGA::GUIEventAdapter* eventState = getEventQueue()->getCurrentEventState();  
     1710    const osgGA::GUIEventAdapter* eventState = getEventQueue()->getCurrentEventState(); 
    17111711    const osgViewer::GraphicsWindow* gw = dynamic_cast<const osgViewer::GraphicsWindow*>(eventState->getGraphicsContext()); 
    17121712 
     
    17201720    { 
    17211721        const osg::Viewport* viewport = _camera->getViewport(); 
    1722          
     1722 
    17231723        double new_x = x; 
    17241724        double new_y = y; 
     
    17311731                       static_cast<double>(_camera->getGraphicsContext()->getTraits()->height) * (y - eventState->getYmin())/(eventState->getYmax()-eventState->getXmin()); 
    17321732        } 
    1733          
    1734         if (viewport &&  
     1733 
     1734        if (viewport && 
    17351735            new_x >= (viewport->x()-epsilon) && new_y >= (viewport->y()-epsilon) && 
    17361736            new_x < (viewport->x()+viewport->width()-1.0+epsilon) && new_y <= (viewport->y()+viewport->height()-1.0+epsilon) ) 
     
    17461746 
    17471747    osg::Matrix masterCameraVPW = getCamera()->getViewMatrix() * getCamera()->getProjectionMatrix(); 
    1748      
     1748 
    17491749    // convert to non dimensional 
    17501750    x = (x - eventState->getXmin()) * 2.0 / (eventState->getXmax()-eventState->getXmin()) - 1.0; 
     
    17521752 
    17531753    if (view_invert_y) y = - y; 
    1754      
     1754 
    17551755    for(int i=getNumSlaves()-1; i>=0; --i) 
    17561756    { 
    17571757        const Slave& slave = getSlave(i); 
    1758         if (slave._camera.valid() &&  
     1758        if (slave._camera.valid() && 
    17591759            slave._camera->getAllowEventFocus() && 
    17601760            slave._camera->getRenderTargetImplementation()==osg::Camera::FRAME_BUFFER) 
     
    17761776            //osg::notify(osg::NOTICE)<<"  new_coord "<<new_coord<<std::endl;; 
    17771777 
    1778             if (viewport &&  
     1778            if (viewport && 
    17791779                new_coord.x() >= (viewport->x()-epsilon) && new_coord.y() >= (viewport->y()-epsilon) && 
    17801780                new_coord.x() < (viewport->x()+viewport->width()-1.0+epsilon) && new_coord.y() <= (viewport->y()+viewport->height()-1.0+epsilon) ) 
    17811781            { 
    17821782                // osg::notify(osg::NOTICE)<<"  in viewport "<<std::endl;; 
    1783                  
     1783 
    17841784                local_x = new_coord.x(); 
    17851785                local_y = new_coord.y(); 
     
    17941794        } 
    17951795    } 
    1796      
     1796 
    17971797    local_x = x; 
    17981798    local_y = y; 
    1799      
     1799 
    18001800    return 0; 
    18011801} 
     
    18051805    if (!_camera.valid()) return false; 
    18061806 
    1807     float local_x, local_y = 0.0;     
     1807    float local_x, local_y = 0.0; 
    18081808    const osg::Camera* camera = getCameraContainingPosition(x, y, local_x, local_y); 
    18091809    if (!camera) camera = _camera.get(); 
    1810      
     1810 
    18111811 
    18121812    osgUtil::LineSegmentIntersector::CoordinateFrame cf = camera->getViewport() ? osgUtil::Intersector::WINDOW : osgUtil::Intersector::PROJECTION; 
     
    18261826    osgUtil::IntersectionVisitor iv(picker.get()); 
    18271827    iv.setTraversalMask(traversalMask); 
    1828      
    1829      
     1828 
     1829 
    18301830#if 1 
    18311831    const_cast<osg::Camera*>(camera)->accept(iv); 
    1832 #else     
     1832#else 
    18331833 
    18341834    // timing test code paths for comparing KdTree based intersections vs conventional intersections 
     
    18381838 
    18391839    const_cast<osg::Camera*>(camera)->accept(iv); 
    1840      
     1840 
    18411841 
    18421842    osg::Timer_t before = osg::Timer::instance()->tick(); 
     
    18561856    const_cast<osg::Camera*>(camera)->accept(iv); 
    18571857    osg::Timer_t after = osg::Timer::instance()->tick(); 
    1858      
     1858 
    18591859    int intersectsAfterConventional = picker->getIntersections().size(); 
    18601860 
     
    18621862    double timeKdTree = osg::Timer::instance()->delta_m(after_dummy, after_kdTree_2); 
    18631863    double timeConventional = osg::Timer::instance()->delta_m(after_kdTree_2, after); 
    1864      
     1864 
    18651865    osg::notify(osg::NOTICE)<<"Using Dummy                    "<<timeDummy<<std::endl; 
    18661866    osg::notify(osg::NOTICE)<<"      KdTrees                  "<<timeKdTree 
     
    18731873    osg::notify(osg::NOTICE)<<"      Delta sans Traversal     "<<(timeConventional-timeDummy)/(timeKdTree-timeDummy)<<std::endl; 
    18741874    osg::notify(osg::NOTICE)<<std::endl; 
    1875 #endif     
     1875#endif 
    18761876 
    18771877    if (picker->containsIntersections()) 
     
    18901890{ 
    18911891    if (!_camera.valid() || nodePath.empty()) return false; 
    1892      
    1893     float local_x, local_y = 0.0;     
     1892 
     1893    float local_x, local_y = 0.0; 
    18941894    const osg::Camera* camera = getCameraContainingPosition(x, y, local_x, local_y); 
    18951895    if (!camera) camera = _camera.get(); 
    1896      
     1896 
    18971897    osg::Matrixd matrix; 
    18981898    if (nodePath.size()>1) 
     
    19011901        matrix = osg::computeLocalToWorld(prunedNodePath); 
    19021902    } 
    1903      
     1903 
    19041904    matrix.postMult(camera->getViewMatrix()); 
    19051905    matrix.postMult(camera->getProjectionMatrix()); 
     
    19191919    osg::Vec3d startVertex = osg::Vec3d(local_x,local_y,zNear) * inverse; 
    19201920    osg::Vec3d endVertex = osg::Vec3d(local_x,local_y,zFar) * inverse; 
    1921      
     1921 
    19221922    osg::ref_ptr< osgUtil::LineSegmentIntersector > picker = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::MODEL, startVertex, endVertex); 
    1923      
     1923 
    19241924    osgUtil::IntersectionVisitor iv(picker.get()); 
    19251925    iv.setTraversalMask(traversalMask); 
     
    19381938} 
    19391939 
     1940