Fixed warnings

This commit is contained in:
Robert Osfield 2016-09-04 19:50:28 +01:00
parent fb4f7a025b
commit 4a6fb5a49a
3 changed files with 39 additions and 35 deletions

View File

@ -195,8 +195,8 @@ ConvertFromInventor::restructure(void* data, SoCallbackAction* action,
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
SoCallbackAction::Response SoCallbackAction::Response
ConvertFromInventor::restructurePreNode(void* data, SoCallbackAction* action, ConvertFromInventor::restructurePreNode(void* data, SoCallbackAction* /*action*/,
const SoNode* node) const SoNode* /*node*/)
{ {
std::vector<std::vector<int> > &stack = *((std::vector<std::vector<int> >*)data); std::vector<std::vector<int> > &stack = *((std::vector<std::vector<int> >*)data);
@ -206,7 +206,7 @@ ConvertFromInventor::restructurePreNode(void* data, SoCallbackAction* action,
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
SoCallbackAction::Response SoCallbackAction::Response
ConvertFromInventor::restructurePostNode(void* data, SoCallbackAction* action, ConvertFromInventor::restructurePostNode(void* data, SoCallbackAction* /*action*/,
const SoNode* node) const SoNode* node)
{ {
std::vector<std::vector<int> > &stack = *((std::vector<std::vector<int> >*)data); std::vector<std::vector<int> > &stack = *((std::vector<std::vector<int> >*)data);
@ -507,7 +507,7 @@ ConvertFromInventor::ivPushState(const SoCallbackAction *action,
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
void void
ConvertFromInventor::ivPopState(const SoCallbackAction *action, ConvertFromInventor::ivPopState(const SoCallbackAction *action,
const SoNode *initiator) const SoNode * /*initiator*/)
{ {
bool multipop; bool multipop;
do { do {
@ -1117,14 +1117,14 @@ SbBool SoTexture2Osg::readInstance(SoInput *in, unsigned short flags)
{ {
// create options and read the file // create options and read the file
osgDB::ReaderWriter::Options *options = createOptions(); osgDB::ReaderWriter::Options *options = createOptions();
osg::ref_ptr<osg::Image> image = loadImage(filename.getValue().getString(), options); osg::ref_ptr<osg::Image> limage = loadImage(filename.getValue().getString(), options);
if (image.valid()) if (limage.valid())
{ {
// get image dimensions and data // get image dimensions and data
int nc = osg::Image::computeNumComponents(image->getPixelFormat()); int nc = osg::Image::computeNumComponents(limage->getPixelFormat());
SbVec2s size(image->s(), image->t()); SbVec2s size(limage->s(), limage->t());
unsigned char *bytes = image->data(); unsigned char *bytes = limage->data();
// disable notification on image while setting data from filename // disable notification on image while setting data from filename
// as a notify will cause a filename.setDefault(TRUE) // as a notify will cause a filename.setDefault(TRUE)
@ -1325,9 +1325,9 @@ ConvertFromInventor::postTexture(void* data, SoCallbackAction *,
SoTexture2 *t = (SoTexture2*)node; SoTexture2 *t = (SoTexture2*)node;
SbVec2s size; SbVec2s size;
int nc; int nc;
const unsigned char *data = t->image.getValue(size, nc); const unsigned char *ldata = t->image.getValue(size, nc);
texturingEnabled = t->filename.getValue().getLength() || texturingEnabled = t->filename.getValue().getLength() ||
(data && size != SbVec2s(0,0)); (ldata && size != SbVec2s(0,0));
} }
#ifdef __COIN__ #ifdef __COIN__
@ -1509,7 +1509,7 @@ ConvertFromInventor::preLight(void* data, SoCallbackAction* action,
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
SoCallbackAction::Response SoCallbackAction::Response
ConvertFromInventor::preEnvironment(void* data, SoCallbackAction* action, ConvertFromInventor::preEnvironment(void* data, SoCallbackAction* /*action*/,
const SoNode* node) const SoNode* node)
{ {
#ifdef DEBUG_IV_PLUGIN #ifdef DEBUG_IV_PLUGIN
@ -1557,7 +1557,7 @@ convertShader(osg::Shader::Type osgShaderType,
#endif // INVENTOR_SHADERS_AVAILABLE #endif // INVENTOR_SHADERS_AVAILABLE
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
SoCallbackAction::Response SoCallbackAction::Response
ConvertFromInventor::preShaderProgram(void* data, SoCallbackAction* action, ConvertFromInventor::preShaderProgram(void* data, SoCallbackAction* /*action*/,
const SoNode* node) const SoNode* node)
{ {
#ifdef DEBUG_IV_PLUGIN #ifdef DEBUG_IV_PLUGIN
@ -1980,7 +1980,7 @@ ConvertFromInventor::convertIVTexToOSGTex(const SoNode* soNode,
} }
/////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////
SoCallbackAction::Response SoCallbackAction::Response
ConvertFromInventor::preInfo(void* data, SoCallbackAction* action, ConvertFromInventor::preInfo(void* /*data*/, SoCallbackAction* /*action*/,
const SoNode* node) const SoNode* node)
{ {
#ifdef DEBUG_IV_PLUGIN #ifdef DEBUG_IV_PLUGIN

View File

@ -249,7 +249,7 @@ void osgArray2ivMField_template(const osg::Array *array, fieldClass &field, int
template<typename ivType, typename osgType, int shift> template<typename ivType, typename osgType, int shift>
void osgArray2ivMField_composite_template_worker(ivType *dest, osgType *src, int num, int numItemsUntilMinusOne = 0) void osgArray2ivMField_composite_template_worker(ivType *dest, osgType *src, int num, int /*numItemsUntilMinusOne*/ = 0)
{ {
for (int i=0; i<num; i++, src+=shift) for (int i=0; i<num; i++, src+=shift)
dest[i] = ivType(src); dest[i] = ivType(src);
@ -257,7 +257,7 @@ void osgArray2ivMField_composite_template_worker(ivType *dest, osgType *src, int
template<> template<>
void osgArray2ivMField_composite_template_worker<SbColor, GLubyte, 4>(SbColor *dest, GLubyte *src, int num, int numItemsUntilMinusOne) void osgArray2ivMField_composite_template_worker<SbColor, GLubyte, 4>(SbColor *dest, GLubyte *src, int num, int /*numItemsUntilMinusOne*/)
{ {
for (int i=0; i<num; i++, src+=4) for (int i=0; i<num; i++, src+=4)
dest[i].setValue(src[0]/255.f, src[1]/255.f, src[2]/255.f); dest[i].setValue(src[0]/255.f, src[1]/255.f, src[2]/255.f);
@ -265,7 +265,7 @@ void osgArray2ivMField_composite_template_worker<SbColor, GLubyte, 4>(SbColor *d
template<> template<>
void osgArray2ivMField_composite_template_worker<SbVec3f, float, 2>(SbVec3f *dest, float *src, int num, int numItemsUntilMinusOne) void osgArray2ivMField_composite_template_worker<SbVec3f, float, 2>(SbVec3f *dest, float *src, int num, int /*numItemsUntilMinusOne*/)
{ {
for (int i=0; i<num; i++, src+=2) for (int i=0; i<num; i++, src+=2)
dest[i].setValue(src[0], src[1], 0.f); dest[i].setValue(src[0], src[1], 0.f);
@ -273,7 +273,7 @@ void osgArray2ivMField_composite_template_worker<SbVec3f, float, 2>(SbVec3f *des
template<typename fieldClass, typename ivType, typename osgType, int shift> template<typename fieldClass, typename ivType, typename osgType, int shift>
void osgArray2ivMField_composite_template(const osg::Array *array, fieldClass &field, int startIndex = 0, int stopIndex = 0, int numItemsUntilMinusOne = 0) void osgArray2ivMField_composite_template(const osg::Array *array, fieldClass &field, int startIndex = 0, int stopIndex = 0, int /*numItemsUntilMinusOne*/ = 0)
{ {
int num = array->getNumElements(); int num = array->getNumElements();
if (startIndex!=0 || stopIndex!=0) { if (startIndex!=0 || stopIndex!=0) {
@ -296,7 +296,7 @@ void osgArray2ivMField_composite_template(const osg::Array *array, fieldClass &f
template<typename fieldClass, typename ivType, typename osgType, int numComponents> template<typename fieldClass, typename ivType, typename osgType, int numComponents>
void osgArray2ivMField_pack_template(const osg::Array *array, fieldClass &field, void osgArray2ivMField_pack_template(const osg::Array *array, fieldClass &field,
osgType mul, osgType max, osgType min, osgType mul, osgType max, osgType min,
int startIndex = 0, int stopIndex = 0, int numItemsUntilMinusOne = 0) int startIndex = 0, int stopIndex = 0, int /*numItemsUntilMinusOne*/ = 0)
{ {
int i,num = array->getNumElements(); int i,num = array->getNumElements();
if (startIndex!=0 || stopIndex!=0) { if (startIndex!=0 || stopIndex!=0) {
@ -1292,11 +1292,11 @@ static bool processPrimitiveSet(const deprecated_osg::Geometry *g, const osg::Pr
case GL_LINE_STRIP: case GL_LINE_STRIP:
if (drawArrayLengths) { if (drawArrayLengths) {
((SoLineSet*)shape)->numVertices.setNum(drawArrayLengthsElems); ((SoLineSet*)shape)->numVertices.setNum(drawArrayLengthsElems);
int i=0; int li=0;
for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin(); for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin();
primItr!=drawArrayLengths->end(); primItr!=drawArrayLengths->end();
++primItr, i++) ++primItr, li++)
((SoLineSet*)shape)->numVertices.set1Value(i, *primItr); ((SoLineSet*)shape)->numVertices.set1Value(li, *primItr);
} else { } else {
((SoLineSet*)shape)->numVertices.setNum(1); ((SoLineSet*)shape)->numVertices.setNum(1);
((SoLineSet*)shape)->numVertices.set1Value(0, elementsCount); ((SoLineSet*)shape)->numVertices.set1Value(0, elementsCount);
@ -1320,11 +1320,11 @@ static bool processPrimitiveSet(const deprecated_osg::Geometry *g, const osg::Pr
case GL_TRIANGLE_STRIP: case GL_TRIANGLE_STRIP:
if (drawArrayLengths) { if (drawArrayLengths) {
((SoTriangleStripSet*)shape)->numVertices.setNum(drawArrayLengthsElems); ((SoTriangleStripSet*)shape)->numVertices.setNum(drawArrayLengthsElems);
int i=0; int li=0;
for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin(); for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin();
primItr!=drawArrayLengths->end(); primItr!=drawArrayLengths->end();
++primItr, i++) ++primItr, li++)
((SoTriangleStripSet*)shape)->numVertices.set1Value(i, *primItr); ((SoTriangleStripSet*)shape)->numVertices.set1Value(li, *primItr);
} else { } else {
((SoTriangleStripSet*)shape)->numVertices.setNum(1); ((SoTriangleStripSet*)shape)->numVertices.setNum(1);
((SoTriangleStripSet*)shape)->numVertices.set1Value(0, elementsCount); ((SoTriangleStripSet*)shape)->numVertices.set1Value(0, elementsCount);
@ -1339,11 +1339,11 @@ static bool processPrimitiveSet(const deprecated_osg::Geometry *g, const osg::Pr
assert(elementsCount % 2 == 0 && "elementsCount is not multiple of 2."); assert(elementsCount % 2 == 0 && "elementsCount is not multiple of 2.");
if (drawArrayLengths) { if (drawArrayLengths) {
((SoTriangleStripSet*)shape)->numVertices.setNum(drawArrayLengthsElems); ((SoTriangleStripSet*)shape)->numVertices.setNum(drawArrayLengthsElems);
int i=0; int li=0;
for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin(); for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin();
primItr!=drawArrayLengths->end(); primItr!=drawArrayLengths->end();
++primItr, i++) ++primItr, li++)
((SoTriangleStripSet*)shape)->numVertices.set1Value(i, *primItr); ((SoTriangleStripSet*)shape)->numVertices.set1Value(li, *primItr);
} else { } else {
((SoTriangleStripSet*)shape)->numVertices.setNum(1); ((SoTriangleStripSet*)shape)->numVertices.setNum(1);
((SoTriangleStripSet*)shape)->numVertices.set1Value(0, elementsCount); ((SoTriangleStripSet*)shape)->numVertices.set1Value(0, elementsCount);
@ -1367,11 +1367,11 @@ static bool processPrimitiveSet(const deprecated_osg::Geometry *g, const osg::Pr
case GL_POLYGON: case GL_POLYGON:
if (drawArrayLengths) { if (drawArrayLengths) {
((SoFaceSet*)shape)->numVertices.setNum(drawArrayLengthsElems); ((SoFaceSet*)shape)->numVertices.setNum(drawArrayLengthsElems);
int i=0; int li=0;
for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin(); for (osg::DrawArrayLengths::const_iterator primItr=drawArrayLengths->begin();
primItr!=drawArrayLengths->end(); primItr!=drawArrayLengths->end();
++primItr, i++) ++primItr, li++)
((SoFaceSet*)shape)->numVertices.set1Value(i, *primItr); ((SoFaceSet*)shape)->numVertices.set1Value(li, *primItr);
} else { } else {
((SoFaceSet*)shape)->numVertices.setNum(1); ((SoFaceSet*)shape)->numVertices.setNum(1);
((SoFaceSet*)shape)->numVertices.set1Value(0, elementsCount); ((SoFaceSet*)shape)->numVertices.set1Value(0, elementsCount);
@ -1507,13 +1507,17 @@ void ConvertToInventor::processGeometry(const deprecated_osg::Geometry *g, Inven
if (ivState->osgMaterial == NULL || if (ivState->osgMaterial == NULL ||
ivState->osgMaterial->getColorMode() == osg::Material::DIFFUSE || ivState->osgMaterial->getColorMode() == osg::Material::DIFFUSE ||
ivState->osgMaterial->getColorMode() == osg::Material::AMBIENT_AND_DIFFUSE) ivState->osgMaterial->getColorMode() == osg::Material::AMBIENT_AND_DIFFUSE)
{
osgArray2ivMField(g->getColorArray(), *colorField); osgArray2ivMField(g->getColorArray(), *colorField);
else; // FIXME: implement some workaround for non-diffuse cases? }
else
{ // FIXME: implement some workaround for non-diffuse cases?
// note: Warning was already shown in createInventorState(). // note: Warning was already shown in createInventorState().
// note2: There is no effect to convert SoMaterial::[ambient|specular|emissive]color // note2: There is no effect to convert SoMaterial::[ambient|specular|emissive]color
// here because Inventor does not set them per-vertex (performance reasons). See // here because Inventor does not set them per-vertex (performance reasons). See
// Inventor documentation for more details. // Inventor documentation for more details.
} }
}
// Convert coordinates // Convert coordinates
@ -1797,7 +1801,7 @@ void ConvertToInventor::processShapeDrawable(const osg::ShapeDrawable *d, Invent
virtual void apply(const osg::CompositeShape&) { warnNonSupported(); } virtual void apply(const osg::CompositeShape&) { warnNonSupported(); }
InventorState *ivState; InventorState *ivState;
MyShapeVisitor(InventorState *ivState) { this->ivState = ivState; } MyShapeVisitor(InventorState * in_ivState) { ivState = in_ivState; }
} shapeVisitor(ivState); } shapeVisitor(ivState);
// convert ShapeDrawable // convert ShapeDrawable

View File

@ -72,7 +72,7 @@ void ReaderWriterIV::initInventor() const
} }
static void errorCallback(const SoError *error, void *data) static void errorCallback(const SoError *error, void * /*data*/)
{ {
// note: Coin and SGI Inventor puts "Inventor read error..." or "Coin warning..." // note: Coin and SGI Inventor puts "Inventor read error..." or "Coin warning..."
// introduction string to the error message, so we do not prepend the error message // introduction string to the error message, so we do not prepend the error message
@ -260,7 +260,7 @@ ReaderWriterIV::readNode(std::istream& fin,
osgDB::ReaderWriter::WriteResult osgDB::ReaderWriter::WriteResult
ReaderWriterIV::writeNode(const osg::Node& node, const std::string& fileName, ReaderWriterIV::writeNode(const osg::Node& node, const std::string& fileName,
const osgDB::ReaderWriter::Options* options) const const osgDB::ReaderWriter::Options* /*options*/) const
{ {
// accept extension // accept extension
std::string ext = osgDB::getLowerCaseFileExtension(fileName); std::string ext = osgDB::getLowerCaseFileExtension(fileName);