Fixes shadows warnings

(cherry picked from commit ae3ba28fee)
This commit is contained in:
Robert Osfield 2016-05-20 13:38:34 +01:00 committed by Ralf Habacker
parent 61ecf0a7e2
commit 10d2f05c31
6 changed files with 29 additions and 33 deletions

View File

@ -817,7 +817,7 @@ int main( int argc, char **argv )
if (internalFormatMode != osg::Texture::USE_IMAGE_DATA_FORMAT) if (internalFormatMode != osg::Texture::USE_IMAGE_DATA_FORMAT)
{ {
std::string ext = osgDB::getFileExtension(fileNameOut); ext = osgDB::getFileExtension(fileNameOut);
CompressTexturesVisitor ctv(internalFormatMode); CompressTexturesVisitor ctv(internalFormatMode);
root->accept(ctv); root->accept(ctv);
ctv.compress(); ctv.compress();

View File

@ -150,11 +150,12 @@ class OSG_EXPORT GraphicsContext : public Object
refreshRate(0), refreshRate(0),
colorDepth(0) colorDepth(0)
{} {}
ScreenSettings(int width, int height, double refreshRate=0, unsigned int colorDepth=0) :
width(width), ScreenSettings(int in_width, int in_height, double in_refreshRate=0, unsigned int in_colorDepth=0) :
height(height), width(in_width),
refreshRate(refreshRate), height(in_height),
colorDepth(colorDepth) refreshRate(in_refreshRate),
colorDepth(in_colorDepth)
{} {}
int width; int width;

View File

@ -1504,11 +1504,11 @@ void Geometry::fixDeprecatedData()
// we start processing the primitive sets. // we start processing the primitive sets.
int target_vindex = 0; int target_vindex = 0;
int source_pindex = -1; // equals primitiveNum int source_pindex = -1; // equals primitiveNum
for(PrimitiveSetList::iterator itr = _primitives.begin(); for(PrimitiveSetList::iterator prim_itr = _primitives.begin();
itr != _primitives.end(); prim_itr != _primitives.end();
++itr) ++prim_itr)
{ {
osg::PrimitiveSet* primitiveset = itr->get(); osg::PrimitiveSet* primitiveset = prim_itr->get();
GLenum mode=primitiveset->getMode(); GLenum mode=primitiveset->getMode();
unsigned int primLength; unsigned int primLength;

View File

@ -561,13 +561,13 @@ static void fillSpotLightImage(unsigned char* ptr, const osg::Vec4& centerColour
float mid = (float(size)-1.0f)*0.5f; float mid = (float(size)-1.0f)*0.5f;
float div = 2.0f/float(size); float div = 2.0f/float(size);
for(unsigned int r=0;r<size;++r) for(unsigned int row=0;row<size;++row)
{ {
//unsigned char* ptr = image->data(0,r,0); //unsigned char* ptr = image->data(0,r,0);
for(unsigned int c=0;c<size;++c) for(unsigned int col=0;col<size;++col)
{ {
float dx = (float(c) - mid)*div; float dx = (float(col) - mid)*div;
float dy = (float(r) - mid)*div; float dy = (float(row) - mid)*div;
float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power); float r = powf(1.0f-sqrtf(dx*dx+dy*dy),power);
if (r<0.0f) r=0.0f; if (r<0.0f) r=0.0f;
osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-r); osg::Vec4 color = centerColour*r+backgroudColour*(1.0f-r);

View File

@ -341,7 +341,6 @@ namespace MatrixDecomposition
#define TOL 1.0e-6 #define TOL 1.0e-6
_HMatrix Mk, MadjTk, Ek; _HMatrix Mk, MadjTk, Ek;
double det, M_one, M_inf, MadjT_one, MadjT_inf, E_one, gamma, g1, g2; double det, M_one, M_inf, MadjT_one, MadjT_inf, E_one, gamma, g1, g2;
int i, j;
mat_tpose(Mk,=,M,3); mat_tpose(Mk,=,M,3);
M_one = norm_one(Mk); M_inf = norm_inf(Mk); M_one = norm_one(Mk); M_inf = norm_inf(Mk);
@ -374,8 +373,8 @@ namespace MatrixDecomposition
mat_tpose(Q,=,Mk,3); mat_pad(Q); mat_tpose(Q,=,Mk,3); mat_pad(Q);
mat_mult(Mk, M, S); mat_pad(S); mat_mult(Mk, M, S); mat_pad(S);
for (i=0; i<3; i++) for (int i=0; i<3; i++)
for (j=i; j<3; j++) for (int j=i; j<3; j++)
S[i][j] = S[j][i] = 0.5*(S[i][j]+S[j][i]); S[i][j] = S[j][i] = 0.5*(S[i][j]+S[j][i]);
return (det); return (det);
} }
@ -393,14 +392,14 @@ namespace MatrixDecomposition
double Diag[3],OffD[3]; /* OffD is off-diag (by omitted index) */ double Diag[3],OffD[3]; /* OffD is off-diag (by omitted index) */
double g,h,fabsh,fabsOffDi,t,theta,c,s,tau,ta,OffDq,a,b; double g,h,fabsh,fabsOffDi,t,theta,c,s,tau,ta,OffDq,a,b;
static char nxt[] = {Y,Z,X}; static char nxt[] = {Y,Z,X};
int sweep, i, j; int sweep;
mat_copy(U,=,mat_id,4); mat_copy(U,=,mat_id,4);
Diag[X] = S[X][X]; Diag[Y] = S[Y][Y]; Diag[Z] = S[Z][Z]; Diag[X] = S[X][X]; Diag[Y] = S[Y][Y]; Diag[Z] = S[Z][Z];
OffD[X] = S[Y][Z]; OffD[Y] = S[Z][X]; OffD[Z] = S[X][Y]; OffD[X] = S[Y][Z]; OffD[Y] = S[Z][X]; OffD[Z] = S[X][Y];
for (sweep=20; sweep>0; sweep--) { for (sweep=20; sweep>0; sweep--) {
double sm = fabs(OffD[X])+fabs(OffD[Y])+fabs(OffD[Z]); double sm = fabs(OffD[X])+fabs(OffD[Y])+fabs(OffD[Z]);
if (sm==0.0) break; 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]; int p = nxt[i]; int q = nxt[p];
fabsOffDi = fabs(OffD[i]); fabsOffDi = fabs(OffD[i]);
g = 100.0*fabsOffDi; g = 100.0*fabsOffDi;
@ -421,7 +420,7 @@ namespace MatrixDecomposition
OffDq = OffD[q]; OffDq = OffD[q];
OffD[q] -= s*(OffD[p] + tau*OffD[q]); OffD[q] -= s*(OffD[p] + tau*OffD[q]);
OffD[p] += s*(OffDq - tau*OffD[p]); 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]; a = U[j][p]; b = U[j][q];
U[j][p] -= s*(b + tau*a); U[j][p] -= s*(b + tau*a);
U[j][q] += s*(a - tau*b); U[j][q] += s*(a - tau*b);
@ -452,7 +451,7 @@ namespace MatrixDecomposition
Quat p = q0001; Quat p = q0001;
double ka[4]; double ka[4];
int i, turn = -1; int turn = -1;
ka[X] = k->x; ka[Y] = k->y; ka[Z] = k->z; ka[X] = k->x; ka[Y] = k->y; ka[Z] = k->z;
if (ka[X]==ka[Y]) { if (ka[X]==ka[Y]) {
@ -482,7 +481,7 @@ namespace MatrixDecomposition
mag[2] = (double)q.y*q.z+(double)q.x*q.w; mag[2] = (double)q.y*q.z+(double)q.x*q.w;
bool neg[3]; bool neg[3];
for (i=0; i<3; i++) for (int i=0; i<3; i++)
{ {
neg[i] = (mag[i]<0.0); neg[i] = (mag[i]<0.0);
if (neg[i]) mag[i] = -mag[i]; if (neg[i]) mag[i] = -mag[i];
@ -516,7 +515,7 @@ namespace MatrixDecomposition
bool neg[4]; bool neg[4];
double all, big, two; double all, big, two;
qa[0] = q.x; qa[1] = q.y; qa[2] = q.z; qa[3] = q.w; 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; pa[i] = 0.0;
neg[i] = (qa[i]<0.0); neg[i] = (qa[i]<0.0);
if (neg[i]) qa[i] = -qa[i]; if (neg[i]) qa[i] = -qa[i];
@ -547,7 +546,7 @@ namespace MatrixDecomposition
big = qa[hi]; big = qa[hi];
if (all>two) { if (all>two) {
if (all>big) {/*all*/ 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); cycle(ka,par);
} }
else {/*big*/ pa[hi] = sgn(neg[hi],1.0);} else {/*big*/ pa[hi] = sgn(neg[hi],1.0);}

View File

@ -147,8 +147,7 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co
const Particle* nextParticle = (particle->getNextParticle() != Particle::INVALID_INDEX) ? &_particles[particle->getNextParticle()] : 0; const Particle* nextParticle = (particle->getNextParticle() != Particle::INVALID_INDEX) ? &_particles[particle->getNextParticle()] : 0;
if (nextParticle) if (nextParticle)
{ {
const osg::Vec3& nextPos = nextParticle->getPosition(); osg::Vec3 startDelta = nextParticle->getPosition()-pos;
osg::Vec3 startDelta = nextPos-pos;
startDelta.normalize(); startDelta.normalize();
float distance2 = 0.0; float distance2 = 0.0;
@ -158,8 +157,7 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co
++i) ++i)
{ {
nextParticle = &_particles[nextParticle->getNextParticle()]; nextParticle = &_particles[nextParticle->getNextParticle()];
const osg::Vec3& nextPos = nextParticle->getPosition(); osg::Vec3 delta = nextParticle->getPosition()-pos;
osg::Vec3 delta = nextPos-pos;
distance2 = (delta^startDelta).length2(); distance2 = (delta^startDelta).length2();
} }
} }
@ -187,8 +185,8 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co
if (nextParticle) if (nextParticle)
{ {
const osg::Vec3& nextPos = nextParticle->getPosition(); osg::Vec3 startDelta = nextParticle->getPosition()-pos;
osg::Vec3 startDelta = nextPos-pos; delta = startDelta;
startDelta.normalize(); startDelta.normalize();
float distance2 = 0.0; float distance2 = 0.0;
@ -198,12 +196,10 @@ void ConnectedParticleSystem::drawImplementation(osg::RenderInfo& renderInfo) co
++i) ++i)
{ {
nextParticle = &_particles[nextParticle->getNextParticle()]; nextParticle = &_particles[nextParticle->getNextParticle()];
const osg::Vec3& nextPos = nextParticle->getPosition(); delta = nextParticle->getPosition()-pos;
delta = nextPos-pos;
distance2 = (delta^startDelta).length2(); distance2 = (delta^startDelta).length2();
} }
delta = nextPos-pos;
} }
osg::Vec3 normal( delta ^ (pos-eyeLocal)); osg::Vec3 normal( delta ^ (pos-eyeLocal));