From dbce12842e2be4dcac732e5f4d584668f934805b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 26 May 2016 11:13:56 +0100 Subject: [PATCH] Fixed shadows warnings --- examples/osgSSBO/osgSSBO.cpp | 6 ++--- examples/osgfpdepth/osgfpdepth.cpp | 12 ++++----- examples/osggpx/osggpx.cpp | 16 ++++++------ examples/osghud/osghud.cpp | 8 +++--- examples/osgoit/DepthPeeling.cpp | 4 +-- examples/osgplanets/osgplanets.cpp | 6 ++--- examples/osgposter/osgposter.cpp | 12 ++++----- examples/osgshadow/osgshadow.cpp | 6 +---- examples/osgspotlight/osgspotlight.cpp | 6 ++--- .../osgthreadedterrain/osgthreadedterrain.cpp | 2 -- examples/osgvirtualprogram/VirtualProgram.cpp | 26 +++++++++---------- examples/osgvolume/osgvolume.cpp | 2 +- 12 files changed, 50 insertions(+), 56 deletions(-) diff --git a/examples/osgSSBO/osgSSBO.cpp b/examples/osgSSBO/osgSSBO.cpp index c08b5ea74..a98baab82 100644 --- a/examples/osgSSBO/osgSSBO.cpp +++ b/examples/osgSSBO/osgSSBO.cpp @@ -500,9 +500,9 @@ osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4& { float dx = (float(c) - mid)*div; float dy = (float(r) - mid)*div; - float r = powf(1.0f - sqrtf(dx*dx + dy*dy), power); - if (r < 0.0f) r = 0.0f; - osg::Vec4 color = centerColour*r + backgroudColour*(1.0f - r); + float pr = powf(1.0f - sqrtf(dx*dx + dy*dy), power); + if (pr < 0.0f) pr = 0.0f; + osg::Vec4 color = centerColour*pr + backgroudColour*(1.0f - pr); *ptr++ = (unsigned char)((color[0])*255.0f); *ptr++ = (unsigned char)((color[1])*255.0f); *ptr++ = (unsigned char)((color[2])*255.0f); diff --git a/examples/osgfpdepth/osgfpdepth.cpp b/examples/osgfpdepth/osgfpdepth.cpp index 73b4ad64e..49e6d349d 100644 --- a/examples/osgfpdepth/osgfpdepth.cpp +++ b/examples/osgfpdepth/osgfpdepth.cpp @@ -108,7 +108,7 @@ typedef vector BufferConfigList; vector validConfigs; // Ugly global variables for the viewport width and height -int width, height; +// int width, height; // This is only used when testing possible frame buffer configurations // to find valid ones. @@ -406,10 +406,10 @@ AppState::AppState(osgViewer::Viewer* viewer_) void AppState::setStateFromConfig(const FboConfig& config) { - Camera* camera = viewer->getSlave(0)._camera.get(); - setAttachmentsFromConfig(camera, config); + Camera* cam = viewer->getSlave(0)._camera.get(); + setAttachmentsFromConfig(cam, config); osgViewer::Renderer* renderer - = dynamic_cast(camera->getRenderer()); + = dynamic_cast(cam->getRenderer()); if (renderer) renderer->setCameraRequiresSetUp(true); if (configText.valid()) @@ -954,8 +954,8 @@ int main(int argc, char **argv) return 1; gc->setResizedCallback(new ResizedCallback(appState.get())); const GraphicsContext::Traits* traits = gc->getTraits(); - width = traits->width; - height = traits->height; + int width = traits->width; + int height = traits->height; if (arguments.argc()<=1) { arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION); diff --git a/examples/osggpx/osggpx.cpp b/examples/osggpx/osggpx.cpp index 5d484cee1..c95bacc9a 100644 --- a/examples/osggpx/osggpx.cpp +++ b/examples/osggpx/osggpx.cpp @@ -437,11 +437,11 @@ int main(int argv, char **argc) osg::ref_ptr loadedModel = osgDB::readRefNodeFiles(arguments); if (loadedModel.valid()) group->addChild(loadedModel); - for(Tracks::iterator itr = tracks.begin(); - itr != tracks.end(); - ++itr) + for(Tracks::iterator titr = tracks.begin(); + titr != tracks.end(); + ++titr) { - Track* track = itr->get(); + Track* track = titr->get(); group->addChild(createTrackModel(track, osg::Vec4(1.0,1.0,1.0,1.0))); @@ -547,11 +547,11 @@ int main(int argv, char **argc) fout<<""<get(); + Track* track = titr->get(); fout<<""<The track description"<addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4)); - osg::StateSet* stateset = geom->getOrCreateStateSet(); - stateset->setMode(GL_BLEND,osg::StateAttribute::ON); - //stateset->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON); - stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); + osg::StateSet* ss = geom->getOrCreateStateSet(); + ss->setMode(GL_BLEND,osg::StateAttribute::ON); + //ss->setAttribute(new osg::PolygonOffset(1.0f,1.0f),osg::StateAttribute::ON); + ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); geode->addDrawable(geom); } diff --git a/examples/osgoit/DepthPeeling.cpp b/examples/osgoit/DepthPeeling.cpp index 38e9296bc..febbf825b 100644 --- a/examples/osgoit/DepthPeeling.cpp +++ b/examples/osgoit/DepthPeeling.cpp @@ -411,8 +411,8 @@ void DepthPeeling::createPeeling() _compositeCamera->setViewMatrix(osg::Matrix()); _compositeCamera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1)); _compositeCamera->setCullCallback(new CullCallback(0, 0)); - osg::StateSet* stateSet = _compositeCamera->getOrCreateStateSet(); - stateSet->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS); + osg::StateSet* ss = _compositeCamera->getOrCreateStateSet(); + ss->setRenderBinDetails(100, "TraversalOrderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS); _root->addChild(_compositeCamera.get()); // solid geometry is blended first, transparency layers are blended in back to front order. diff --git a/examples/osgplanets/osgplanets.cpp b/examples/osgplanets/osgplanets.cpp index ffea3ef00..016754aff 100644 --- a/examples/osgplanets/osgplanets.cpp +++ b/examples/osgplanets/osgplanets.cpp @@ -127,9 +127,9 @@ osg::Image* createBillboardImage(const osg::Vec4& centerColour, unsigned int siz { float dx = (float(c) - mid)*div; float dy = (float(r) - mid)*div; - float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power); - if (r<0.0f) r=0.0f; - osg::Vec4 color = centerColour*r+backgroundColour*(1.0f-r); + float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power); + if (pr<0.0f) r=0.0f; + osg::Vec4 color = centerColour*pr+backgroundColour*(1.0f-pr); // color.set(1.0f,1.0f,1.0f,0.5f); *ptr++ = (unsigned char)((color[0])*255.0f); *ptr++ = (unsigned char)((color[1])*255.0f); diff --git a/examples/osgposter/osgposter.cpp b/examples/osgposter/osgposter.cpp index 1b5464f7d..6f5cb820e 100644 --- a/examples/osgposter/osgposter.cpp +++ b/examples/osgposter/osgposter.cpp @@ -371,19 +371,19 @@ int main( int argc, char** argv ) } else { - osg::Camera* camera = viewer.getCamera(); - if ( !useLatLongHeight ) computeViewMatrix( camera, eye, hpr ); - else computeViewMatrixOnEarth( camera, scene.get(), latLongHeight, hpr ); + osg::Camera* viewer_camera = viewer.getCamera(); + if ( !useLatLongHeight ) computeViewMatrix( viewer_camera, eye, hpr ); + else computeViewMatrixOnEarth( viewer_camera, scene.get(), latLongHeight, hpr ); - osg::ref_ptr renderer = new CustomRenderer( camera ); - camera->setRenderer( renderer.get() ); + osg::ref_ptr renderer = new CustomRenderer( viewer_camera ); + viewer_camera->setRenderer( renderer.get() ); viewer.setThreadingModel( osgViewer::Viewer::SingleThreaded ); // Realize and initiate the first PagedLOD request viewer.realize(); viewer.frame(); - printer->init( camera ); + printer->init( viewer_camera ); while ( !printer->done() ) { viewer.advance(); diff --git a/examples/osgshadow/osgshadow.cpp b/examples/osgshadow/osgshadow.cpp index d1087711e..82a3330e4 100644 --- a/examples/osgshadow/osgshadow.cpp +++ b/examples/osgshadow/osgshadow.cpp @@ -1108,7 +1108,7 @@ int main(int argc, char** argv) if (fov!=0.0) { - double fovy, aspectRatio, zNear, zFar; + double fovy, aspectRatio; viewer.getCamera()->getProjectionMatrix().getPerspective(fovy, aspectRatio, zNear, zFar); std::cout << "Setting FOV to " << fov << std::endl; @@ -1144,8 +1144,6 @@ int main(int argc, char** argv) while (!viewer.done()) { { - osgShadow::MinimalShadowMap * msm = dynamic_cast( shadowedScene->getShadowTechnique() ); - if( msm ) { // If scene decorated by CoordinateSystemNode try to find localToWorld @@ -1198,8 +1196,6 @@ int main(int argc, char** argv) char filename[256]; std::sprintf( filename, "shadowDump%d.osgt", dumpFileNo ); - osgShadow::MinimalShadowMap * msm = dynamic_cast( shadowedScene->getShadowTechnique() ); - if( msm ) msm->setDebugDump( filename ); } diff --git a/examples/osgspotlight/osgspotlight.cpp b/examples/osgspotlight/osgspotlight.cpp index 2e8d88b8d..737f1cb56 100644 --- a/examples/osgspotlight/osgspotlight.cpp +++ b/examples/osgspotlight/osgspotlight.cpp @@ -54,9 +54,9 @@ osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4& { float dx = (float(c) - mid)*div; float dy = (float(r) - mid)*div; - float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power); - if (r<0.0f) r=0.0f; - osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-r); + float pr = powf(1.0f-sqrtf(dx*dx+dy*dy),power); + if (pr<0.0f) pr=0.0f; + osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-pr); *ptr++ = (unsigned char)((color[0])*255.0f); *ptr++ = (unsigned char)((color[1])*255.0f); *ptr++ = (unsigned char)((color[2])*255.0f); diff --git a/examples/osgthreadedterrain/osgthreadedterrain.cpp b/examples/osgthreadedterrain/osgthreadedterrain.cpp index 7a1868ef8..c454a867c 100644 --- a/examples/osgthreadedterrain/osgthreadedterrain.cpp +++ b/examples/osgthreadedterrain/osgthreadedterrain.cpp @@ -55,8 +55,6 @@ #include -typedef std::vector< osg::ref_ptr > GraphicsThreads; - struct ReleaseBlockOnCompileCompleted : public osgUtil::IncrementalCompileOperation::CompileCompletedCallback { diff --git a/examples/osgvirtualprogram/VirtualProgram.cpp b/examples/osgvirtualprogram/VirtualProgram.cpp index 3185bb86f..a25aeb19e 100644 --- a/examples/osgvirtualprogram/VirtualProgram.cpp +++ b/examples/osgvirtualprogram/VirtualProgram.cpp @@ -11,21 +11,21 @@ using namespace osg; // If graphics board has program linking problems set MERGE_SHADERS to 1 -// Merge shaders can be used to merge shaders strings into one shader. +// Merge shaders can be used to merge shaders strings into one shader. #define MERGE_SHADERS 0 #define NOTIFICATION_MESSAGES 0 namespace osgCandidate { //////////////////////////////////////////////////////////////////////////////// -VirtualProgram::VirtualProgram( unsigned int mask ) : _mask( mask ) +VirtualProgram::VirtualProgram( unsigned int mask ) : _mask( mask ) { } //////////////////////////////////////////////////////////////////////////////// VirtualProgram::VirtualProgram - ( const VirtualProgram& VirtualProgram, const osg::CopyOp& copyop ): - osg::Program( VirtualProgram, copyop ), - _shaderMap( VirtualProgram._shaderMap ), - _mask( VirtualProgram._mask ) + ( const VirtualProgram& vp, const osg::CopyOp& copyop ): + osg::Program( vp, copyop ), + _shaderMap( vp._shaderMap ), + _mask( vp._mask ) { } //////////////////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ osg::Shader * VirtualProgram::getShader osg::Shader * VirtualProgram::setShader ( const std::string & shaderSemantic, osg::Shader * shader ) { - if( shader->getType() == osg::Shader::UNDEFINED ) + if( shader->getType() == osg::Shader::UNDEFINED ) return NULL; ShaderMap::key_type key( shaderSemantic, shader->getType() ); @@ -52,8 +52,8 @@ osg::Shader * VirtualProgram::setShader ref_ptr< osg::Shader > shaderNew = shader; ref_ptr< osg::Shader > & shaderCurrent = _shaderMap[ key ]; -#if 0 // Good for debugging of shader linking problems. - // Don't do it - User could use the name for its own purposes +#if 0 // Good for debugging of shader linking problems. + // Don't do it - User could use the name for its own purposes shaderNew->setName( shaderSemantic ); #endif @@ -84,16 +84,16 @@ void VirtualProgram::apply( osg::State & state ) const #endif ShaderMap shaderMap; - for( State::AttributeVec::iterator i = av->begin(); i != av->end(); ++i ) + for( State::AttributeVec::iterator ai = av->begin(); ai != av->end(); ++ai ) { - const osg::StateAttribute * sa = i->first; + const osg::StateAttribute * sa = ai->first; const VirtualProgram * vp = dynamic_cast< const VirtualProgram *>( sa ); if( vp && ( vp->_mask & _mask ) ) { #if NOTIFICATION_MESSAGES if( vp->getName().empty() ) os << "VirtualProgram cumulate [ Unnamed VP ] apply" << std::endl; - else + else os << "VirtualProgram cumulate ["<< vp->getName() << "] apply" << std::endl; #endif @@ -136,7 +136,7 @@ void VirtualProgram::apply( osg::State & state ) const std::string strFragment; std::string strVertex; std::string strGeometry; - + for( ShaderList::iterator i = sl.begin(); i != sl.end(); ++i ) { if( i->get()->getType() == osg::Shader::FRAGMENT ) diff --git a/examples/osgvolume/osgvolume.cpp b/examples/osgvolume/osgvolume.cpp index 1dc1a4e75..e444db521 100644 --- a/examples/osgvolume/osgvolume.cpp +++ b/examples/osgvolume/osgvolume.cpp @@ -766,7 +766,7 @@ int main( int argc, char **argv ) { if (!arguments.isOption(pos)) { - std::string filename = arguments[pos]; + filename = arguments[pos]; if (osgDB::getLowerCaseFileExtension(filename)=="dicom") { // not an option so assume string is a filename.