Fixed shadows warnings

This commit is contained in:
Robert Osfield 2016-05-23 16:20:59 +01:00
parent 5260e3a35e
commit 4b61f4c95d
4 changed files with 42 additions and 48 deletions

View File

@ -234,15 +234,14 @@ void PerlinNoise::initNoise(void)
double PerlinNoise::PerlinNoise1D(double x,double alpha,double beta,int n)
{
int i;
double val,sum = 0;
double p,scale = 1;
p = x;
double val,sum = 0.0;
double scale = 1.0;
double pv = x;
for (i=0;i<n;i++) {
val = noise1(p);
val = noise1(pv);
sum += val / scale;
scale *= alpha;
p *= beta;
pv *= beta;
}
return(sum);
}
@ -250,17 +249,17 @@ double PerlinNoise::PerlinNoise1D(double x,double alpha,double beta,int n)
double PerlinNoise::PerlinNoise2D(double x,double y,double alpha,double beta,int n)
{
int i;
double val,sum = 0;
double p[2],scale = 1;
double sum = 0.0;
double pv[2],scale = 1.0;
p[0] = x;
p[1] = y;
pv[0] = x;
pv[1] = y;
for (i=0;i<n;i++) {
val = noise2(p);
double val = noise2(pv);
sum += val / scale;
scale *= alpha;
p[0] *= beta;
p[1] *= beta;
pv[0] *= beta;
pv[1] *= beta;
}
return(sum);
}
@ -268,19 +267,19 @@ double PerlinNoise::PerlinNoise2D(double x,double y,double alpha,double beta,int
double PerlinNoise::PerlinNoise3D(double x,double y,double z,double alpha,double beta,int n)
{
int i;
double val,sum = 0;
double p[3],scale = 1;
double sum = 0.0;
double pv[3],scale = 1.0;
p[0] = x;
p[1] = y;
p[2] = z;
pv[0] = x;
pv[1] = y;
pv[2] = z;
for (i=0;i<n;i++) {
val = noise3(p);
double val = noise3(pv);
sum += val / scale;
scale *= alpha;
p[0] *= beta;
p[1] *= beta;
p[2] *= beta;
pv[0] *= beta;
pv[1] *= beta;
pv[2] *= beta;
}
return(sum);
}

View File

@ -248,8 +248,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo)
int width = static_cast<int>(_viewport->x() + _viewport->width());
int height = static_cast<int>(_viewport->y() + _viewport->height());
int depth = 1;
osg::Camera::BufferAttachmentMap::iterator itr;
for(itr = bufferAttachments.begin();
for(osg::Camera::BufferAttachmentMap::iterator itr = bufferAttachments.begin();
itr != bufferAttachments.end();
++itr)
{
@ -262,7 +261,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo)
// OSG_NOTICE<<"RenderStage::runCameraSetUp computed "<<width<<" "<<height<<" "<<depth<<std::endl;
// attach images that need to be copied after the stage is drawn.
for(itr = bufferAttachments.begin();
for(osg::Camera::BufferAttachmentMap::iterator itr = bufferAttachments.begin();
itr != bufferAttachments.end();
++itr)
{
@ -552,8 +551,7 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo)
{
fbo_multisample->apply(state);
GLenum status = ext->glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
status = ext->glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
{
OSG_NOTICE << "RenderStage::runCameraSetUp(), "
@ -1039,8 +1037,7 @@ void RenderStage::drawInner(osg::RenderInfo& renderInfo,RenderLeaf*& previous, b
copyTexture(renderInfo);
}
std::map< osg::Camera::BufferComponent, Attachment>::const_iterator itr;
for(itr = _bufferAttachmentMap.begin();
for(std::map< osg::Camera::BufferComponent, Attachment>::const_iterator itr = _bufferAttachmentMap.begin();
itr != _bufferAttachmentMap.end();
++itr)
{

View File

@ -481,11 +481,11 @@ struct FindSharpEdgesFunctor
Triangles::iterator titr = pv->_triangles.begin();
while(titr != pv->_triangles.end())
{
Triangle* tri = titr->get();
osg::Vec3 normal = computeNormal(tri->_p1, tri->_p2, tri->_p3);
Triangle* pv_tri = titr->get();
osg::Vec3 normal = computeNormal(pv_tri->_p1, pv_tri->_p2, pv_tri->_p3);
Triangles associatedTriangles;
associatedTriangles.push_back(tri);
associatedTriangles.push_back(pv_tri);
// remove triangle for list
pv->_triangles.erase(titr);
@ -516,7 +516,7 @@ struct FindSharpEdgesFunctor
// create duplicate vertex to set of associated triangles
unsigned int duplicated_p = duplicateVertex(p);
// now rest the index on th triangles of the point that was duplicated
// now rest the index on the triangles of the point that was duplicated
for(Triangles::iterator aitr = associatedTriangles.begin();
aitr != associatedTriangles.end();
++aitr)

View File

@ -231,8 +231,7 @@ void TriStripVisitor::stripify(Geometry& geom)
unsigned int numSurfacePrimitives = 0;
unsigned int numNonSurfacePrimitives = 0;
Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList();
Geometry::PrimitiveSetList::iterator itr;
for(itr=primitives.begin();
for(Geometry::PrimitiveSetList::iterator itr=primitives.begin();
itr!=primitives.end();
++itr)
{
@ -258,24 +257,23 @@ void TriStripVisitor::stripify(Geometry& geom)
// compute duplicate vertices
typedef std::vector<unsigned int> IndexList;
unsigned int numVertices = geom.getVertexArray()->getNumElements();
IndexList indices(numVertices);
IndexList vindices(numVertices);
unsigned int i,j;
for(i=0;i<numVertices;++i)
{
indices[i] = i;
vindices[i] = i;
}
VertexAttribComparitor arrayComparitor(geom);
std::sort(indices.begin(),indices.end(),arrayComparitor);
std::sort(vindices.begin(), vindices.end(), arrayComparitor);
unsigned int lastUnique = 0;
unsigned int numUnique = 1;
unsigned int numDuplicate = 0;
for(i=1;i<numVertices;++i)
{
if (arrayComparitor.compare(indices[lastUnique],indices[i])==0)
if (arrayComparitor.compare(vindices[lastUnique], vindices[i])==0)
{
//std::cout<<" found duplicate "<<indices[lastUnique]<<" and "<<indices[i]<<std::endl;
++numDuplicate;
@ -297,31 +295,31 @@ void TriStripVisitor::stripify(Geometry& geom)
lastUnique = 0;
for(i=1;i<numVertices;++i)
{
if (arrayComparitor.compare(indices[lastUnique],indices[i])!=0)
if (arrayComparitor.compare(vindices[lastUnique], vindices[i])!=0)
{
// found a new vertex entry, so previous run of duplicates needs
// to be put together.
unsigned int min_index = indices[lastUnique];
unsigned int min_index = vindices[lastUnique];
for(j=lastUnique+1;j<i;++j)
{
min_index = osg::minimum(min_index,indices[j]);
min_index = osg::minimum(min_index, vindices[j]);
}
for(j=lastUnique;j<i;++j)
{
remapDuplicatesToOrignals[indices[j]]=min_index;
remapDuplicatesToOrignals[vindices[j]]=min_index;
}
lastUnique = i;
}
}
unsigned int min_index = indices[lastUnique];
unsigned int min_index = vindices[lastUnique];
for(j=lastUnique+1;j<i;++j)
{
min_index = osg::minimum(min_index,indices[j]);
min_index = osg::minimum(min_index, vindices[j]);
}
for(j=lastUnique;j<i;++j)
{
remapDuplicatesToOrignals[indices[j]]=min_index;
remapDuplicatesToOrignals[vindices[j]]=min_index;
}
@ -355,7 +353,7 @@ void TriStripVisitor::stripify(Geometry& geom)
Geometry::PrimitiveSetList new_primitives;
new_primitives.reserve(primitives.size());
for(itr=primitives.begin();
for(Geometry::PrimitiveSetList::iterator itr=primitives.begin();
itr!=primitives.end();
++itr)
{