From 10d2f05c3195460c3e366a28fe5ba7bf4489baf2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 20 May 2016 13:38:34 +0100 Subject: [PATCH] Fixes shadows warnings (cherry picked from commit ae3ba28feef1a8a9a9fad1c32da9d855802cc7c7) --- applications/osgconv/osgconv.cpp | 2 +- include/osg/GraphicsContext | 11 ++++++----- src/osg/Geometry.cpp | 8 ++++---- src/osg/ImageUtils.cpp | 8 ++++---- src/osg/MatrixDecomposition.cpp | 19 +++++++++---------- src/osgParticle/ConnectedParticleSystem.cpp | 14 +++++--------- 6 files changed, 29 insertions(+), 33 deletions(-) diff --git a/applications/osgconv/osgconv.cpp b/applications/osgconv/osgconv.cpp index 098dec37b..b93f52894 100644 --- a/applications/osgconv/osgconv.cpp +++ b/applications/osgconv/osgconv.cpp @@ -817,7 +817,7 @@ int main( int argc, char **argv ) if (internalFormatMode != osg::Texture::USE_IMAGE_DATA_FORMAT) { - std::string ext = osgDB::getFileExtension(fileNameOut); + ext = osgDB::getFileExtension(fileNameOut); CompressTexturesVisitor ctv(internalFormatMode); root->accept(ctv); ctv.compress(); diff --git a/include/osg/GraphicsContext b/include/osg/GraphicsContext index ec06b29ef..d946f8a58 100644 --- a/include/osg/GraphicsContext +++ b/include/osg/GraphicsContext @@ -150,11 +150,12 @@ class OSG_EXPORT GraphicsContext : public Object refreshRate(0), colorDepth(0) {} - ScreenSettings(int width, int height, double refreshRate=0, unsigned int colorDepth=0) : - width(width), - height(height), - refreshRate(refreshRate), - colorDepth(colorDepth) + + ScreenSettings(int in_width, int in_height, double in_refreshRate=0, unsigned int in_colorDepth=0) : + width(in_width), + height(in_height), + refreshRate(in_refreshRate), + colorDepth(in_colorDepth) {} int width; diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 244bf25a2..fe57a9eee 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -1504,11 +1504,11 @@ void Geometry::fixDeprecatedData() // we start processing the primitive sets. int target_vindex = 0; int source_pindex = -1; // equals primitiveNum - for(PrimitiveSetList::iterator itr = _primitives.begin(); - itr != _primitives.end(); - ++itr) + for(PrimitiveSetList::iterator prim_itr = _primitives.begin(); + prim_itr != _primitives.end(); + ++prim_itr) { - osg::PrimitiveSet* primitiveset = itr->get(); + osg::PrimitiveSet* primitiveset = prim_itr->get(); GLenum mode=primitiveset->getMode(); unsigned int primLength; diff --git a/src/osg/ImageUtils.cpp b/src/osg/ImageUtils.cpp index 78b5a0564..6131630f6 100644 --- a/src/osg/ImageUtils.cpp +++ b/src/osg/ImageUtils.cpp @@ -561,13 +561,13 @@ static void fillSpotLightImage(unsigned char* ptr, const osg::Vec4& centerColour float mid = (float(size)-1.0f)*0.5f; float div = 2.0f/float(size); - for(unsigned int r=0;rdata(0,r,0); - for(unsigned int c=0;c0; sweep--) { double sm = fabs(OffD[X])+fabs(OffD[Y])+fabs(OffD[Z]); if (sm==0.0) break; - for (i=Z; i>=X; i--) { + for (int i=Z; i>=X; i--) { int p = nxt[i]; int q = nxt[p]; fabsOffDi = fabs(OffD[i]); g = 100.0*fabsOffDi; @@ -421,7 +420,7 @@ namespace MatrixDecomposition OffDq = OffD[q]; OffD[q] -= s*(OffD[p] + tau*OffD[q]); OffD[p] += s*(OffDq - tau*OffD[p]); - for (j=Z; j>=X; j--) { + for (int j=Z; j>=X; j--) { a = U[j][p]; b = U[j][q]; U[j][p] -= s*(b + tau*a); U[j][q] += s*(a - tau*b); @@ -452,7 +451,7 @@ namespace MatrixDecomposition Quat p = q0001; double ka[4]; - int i, turn = -1; + int turn = -1; ka[X] = k->x; ka[Y] = k->y; ka[Z] = k->z; if (ka[X]==ka[Y]) { @@ -482,7 +481,7 @@ namespace MatrixDecomposition mag[2] = (double)q.y*q.z+(double)q.x*q.w; bool neg[3]; - for (i=0; i<3; i++) + for (int i=0; i<3; i++) { neg[i] = (mag[i]<0.0); if (neg[i]) mag[i] = -mag[i]; @@ -516,7 +515,7 @@ namespace MatrixDecomposition bool neg[4]; double all, big, two; qa[0] = q.x; qa[1] = q.y; qa[2] = q.z; qa[3] = q.w; - for (i=0; i<4; i++) { + for (int i=0; i<4; i++) { pa[i] = 0.0; neg[i] = (qa[i]<0.0); if (neg[i]) qa[i] = -qa[i]; @@ -547,7 +546,7 @@ namespace MatrixDecomposition big = qa[hi]; if (all>two) { if (all>big) {/*all*/ - {int i; for (i=0; i<4; i++) pa[i] = sgn(neg[i], 0.5);} + {for (int i=0; i<4; i++) pa[i] = sgn(neg[i], 0.5);} cycle(ka,par); } else {/*big*/ pa[hi] = sgn(neg[hi],1.0);} diff --git a/src/osgParticle/ConnectedParticleSystem.cpp b/src/osgParticle/ConnectedParticleSystem.cpp index 30a4c5372..923315c8c 100644 --- a/src/osgParticle/ConnectedParticleSystem.cpp +++ b/src/osgParticle/ConnectedParticleSystem.cpp @@ -147,8 +147,7 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co const Particle* nextParticle = (particle->getNextParticle() != Particle::INVALID_INDEX) ? &_particles[particle->getNextParticle()] : 0; if (nextParticle) { - const osg::Vec3& nextPos = nextParticle->getPosition(); - osg::Vec3 startDelta = nextPos-pos; + osg::Vec3 startDelta = nextParticle->getPosition()-pos; startDelta.normalize(); float distance2 = 0.0; @@ -158,8 +157,7 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co ++i) { nextParticle = &_particles[nextParticle->getNextParticle()]; - const osg::Vec3& nextPos = nextParticle->getPosition(); - osg::Vec3 delta = nextPos-pos; + osg::Vec3 delta = nextParticle->getPosition()-pos; distance2 = (delta^startDelta).length2(); } } @@ -187,8 +185,8 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co if (nextParticle) { - const osg::Vec3& nextPos = nextParticle->getPosition(); - osg::Vec3 startDelta = nextPos-pos; + osg::Vec3 startDelta = nextParticle->getPosition()-pos; + delta = startDelta; startDelta.normalize(); float distance2 = 0.0; @@ -198,12 +196,10 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co ++i) { nextParticle = &_particles[nextParticle->getNextParticle()]; - const osg::Vec3& nextPos = nextParticle->getPosition(); - delta = nextPos-pos; + delta = nextParticle->getPosition()-pos; distance2 = (delta^startDelta).length2(); } - delta = nextPos-pos; } osg::Vec3 normal( delta ^ (pos-eyeLocal));