diff --git a/src/osgPlugins/logo/ReaderWriterLOGO.cpp b/src/osgPlugins/logo/ReaderWriterLOGO.cpp index 059c8a84f..5b342f30b 100644 --- a/src/osgPlugins/logo/ReaderWriterLOGO.cpp +++ b/src/osgPlugins/logo/ReaderWriterLOGO.cpp @@ -72,7 +72,7 @@ class Logos: public osg::Drawable sset->setRenderBinDetails( StateSet::TRANSPARENT_BIN + 1 , "RenderBin" ); #endif setStateSet( sset ); - viewport = new osg::Viewport; + _viewport = new osg::Viewport; setCullCallback( new logosCullCallback ); _contextID = 0; } @@ -94,12 +94,12 @@ class Logos: public osg::Drawable float vy = 0.0; float vw = 1.0; float vh = 1.0; - if (viewport) + if (_viewport.valid()) { - vx = viewport->x(); - vy = viewport->y(); - vw = viewport->width(); - vh = viewport->height(); + vx = _viewport->x(); + vy = _viewport->y(); + vw = _viewport->width(); + vh = _viewport->height(); } glMatrixMode( GL_PROJECTION ); @@ -113,10 +113,12 @@ class Logos: public osg::Drawable glColor4f( 1, 1, 1, 1 ); - std::vector ::const_iterator p; + Images::const_iterator p; float th = 0.0; - for( p = logos[Center].begin(); p != logos[Center].end(); p++ ) + for( p = _logos[Center].begin(); p != _logos[Center].end(); p++ ) + { th += (*p)->t(); + } float place[][4] = { { vw*0.5, ((vh*0.5) + th*0.5), -0.5, -1.0 }, @@ -130,13 +132,13 @@ class Logos: public osg::Drawable for( int i = Center; i < last_position; i++ ) { - if( logos[i].size() != 0 ) + if( _logos[i].size() != 0 ) { float x = place[i][0]; float y = place[i][1]; float xi = place[i][2]; float yi = place[i][3]; - for( p = logos[i].begin(); p != logos[i].end(); p++ ) + for( p = _logos[i].begin(); p != _logos[i].end(); p++ ) { osg::Image *img = *p; x = place[i][0] + xi * img->s(); @@ -160,19 +162,19 @@ class Logos: public osg::Drawable { osg::ref_ptr image = osgDB::readRefImageFile( name.c_str() ); if( image.valid()) - logos[pos].push_back( image.get() ); + _logos[pos].push_back( image ); else osg::notify(osg::WARN)<< "Logos::addLogo image file not found : " << name << ".\n"; } - osg::Viewport *getViewport() { return viewport; } + osg::Viewport *getViewport() { return _viewport.get(); } void setContextID( unsigned int id ) { _contextID = id; } bool hasLogos() { int n = 0; for( int i = Center; i < last_position; i++ ) - n += logos[i].size(); + n += _logos[i].size(); return (n != 0); } @@ -186,8 +188,10 @@ class Logos: public osg::Drawable virtual ~Logos() {} private : - std::vector logos[last_position]; - osg::Viewport *viewport; + typedef std::vector < osg::ref_ptr > Images; + + Images _logos[last_position]; + osg::ref_ptr _viewport; unsigned int _contextID; };