From 4f561d84b3c1762d1fcee61f3ae9a3014dd8c6c3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 17 Dec 2008 16:02:42 +0000 Subject: [PATCH] Fixed warnings --- .../OpenFlight/FltExportVisitor.cpp | 2 +- .../OpenFlight/LightPointRecords.cpp | 2 +- .../OpenFlight/LightSourcePaletteManager.cpp | 5 +-- .../OpenFlight/MaterialPaletteManager.cpp | 4 +-- .../OpenFlight/TexturePaletteManager.cpp | 4 +-- .../OpenFlight/TexturePaletteManager.h | 1 + .../OpenFlight/VertexPaletteManager.cpp | 8 ++--- .../OpenFlight/expGeometryRecords.cpp | 35 ++++++++++--------- .../OpenFlight/expPrimaryRecords.cpp | 4 +-- 9 files changed, 35 insertions(+), 30 deletions(-) diff --git a/src/osgPlugins/OpenFlight/FltExportVisitor.cpp b/src/osgPlugins/OpenFlight/FltExportVisitor.cpp index 9b5f76b43..437fdb22a 100644 --- a/src/osgPlugins/OpenFlight/FltExportVisitor.cpp +++ b/src/osgPlugins/OpenFlight/FltExportVisitor.cpp @@ -64,8 +64,8 @@ FltExportVisitor::FltExportVisitor( DataOutputStream* dos, ExportOptions* fltOpt ) : osg::NodeVisitor( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN ), - _dos( *dos ), _fltOpt( fltOpt ), + _dos( *dos ), _materialPalette( new MaterialPaletteManager( *fltOpt ) ), _texturePalette( new TexturePaletteManager( *this, *fltOpt ) ), _lightSourcePalette( new LightSourcePaletteManager( *fltOpt ) ), diff --git a/src/osgPlugins/OpenFlight/LightPointRecords.cpp b/src/osgPlugins/OpenFlight/LightPointRecords.cpp index 110bf4b06..dc7fc299d 100644 --- a/src/osgPlugins/OpenFlight/LightPointRecords.cpp +++ b/src/osgPlugins/OpenFlight/LightPointRecords.cpp @@ -377,7 +377,7 @@ protected: std::string id = in.readString(8); int32 appearanceIndex = in.readInt32(); int32 animationIndex = in.readInt32(); - int32 drawOrder = in.readInt32(); // for calligraphic lights + /*int32 drawOrder =*/ in.readInt32(); // for calligraphic lights LightPointAppearancePool* lpAppearancePool = document.getOrCreateLightPointAppearancePool(); _appearance = lpAppearancePool->get(appearanceIndex); diff --git a/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp b/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp index 4d3c74a7e..53d62a530 100644 --- a/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/LightSourcePaletteManager.cpp @@ -29,8 +29,9 @@ namespace flt LightSourcePaletteManager::LightSourcePaletteManager( ExportOptions& fltOpt ) - : _fltOpt( fltOpt ), - _currIndex( -1 ) + : _currIndex( -1 ), + _fltOpt( fltOpt ) + { // TODO: Pay attention to the version here(?) } diff --git a/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp b/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp index b44e9c3ac..fccdd3244 100644 --- a/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/MaterialPaletteManager.cpp @@ -28,8 +28,8 @@ namespace flt MaterialPaletteManager::MaterialPaletteManager( ExportOptions& fltOpt ) - : _fltOpt( fltOpt ), - _currIndex( -1 ) + : _currIndex( -1 ), + _fltOpt( fltOpt ) { // TODO: Pay attention to the version here(?) } diff --git a/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp b/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp index 76940a181..a2c2f8869 100644 --- a/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/TexturePaletteManager.cpp @@ -30,9 +30,9 @@ namespace flt TexturePaletteManager::TexturePaletteManager( const FltExportVisitor& nv, const ExportOptions& fltOpt ) - : _fltOpt( fltOpt ), + : _currIndex( 0 ), _nv( nv ), - _currIndex( 0 ) + _fltOpt( fltOpt ) { } diff --git a/src/osgPlugins/OpenFlight/TexturePaletteManager.h b/src/osgPlugins/OpenFlight/TexturePaletteManager.h index f998d0f10..a14bbfc60 100644 --- a/src/osgPlugins/OpenFlight/TexturePaletteManager.h +++ b/src/osgPlugins/OpenFlight/TexturePaletteManager.h @@ -45,6 +45,7 @@ public: void write( DataOutputStream& dos ) const; protected: + int _currIndex; typedef std::map< const osg::Texture2D*, int > TextureIndexMap; diff --git a/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp b/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp index 0b559a346..80593b7bb 100644 --- a/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp +++ b/src/osgPlugins/OpenFlight/VertexPaletteManager.cpp @@ -28,10 +28,10 @@ namespace flt VertexPaletteManager::VertexPaletteManager( const ExportOptions& fltOpt ) - : _fltOpt( fltOpt ), - _currentSizeBytes( 8 ), + : _currentSizeBytes( 8 ), _current( NULL ), - _vertices( NULL ) + _vertices( NULL ), + _fltOpt( fltOpt ) { } @@ -223,7 +223,7 @@ VertexPaletteManager::writeRecords( const osg::Vec3dArray* v, const osg::Vec4Arr const PaletteRecordType recType = recordType( v, c, n, t ); const int16 sizeBytes = recordSize( recType ); - int16 opcode; + int16 opcode = 0; switch( recType ) { case VERTEX_C: diff --git a/src/osgPlugins/OpenFlight/expGeometryRecords.cpp b/src/osgPlugins/OpenFlight/expGeometryRecords.cpp index bdd18f041..2544a15b6 100644 --- a/src/osgPlugins/OpenFlight/expGeometryRecords.cpp +++ b/src/osgPlugins/OpenFlight/expGeometryRecords.cpp @@ -38,13 +38,15 @@ namespace flt // Bit flags for multitexturing static unsigned int LAYER_1( 0x80000000 >> 0 ); +#if 0 +// unused so if'deffing out static unsigned int LAYER_2( 0x80000000 >> 1 ); static unsigned int LAYER_3( 0x80000000 >> 2 ); static unsigned int LAYER_4( 0x80000000 >> 3 ); static unsigned int LAYER_5( 0x80000000 >> 4 ); static unsigned int LAYER_6( 0x80000000 >> 5 ); static unsigned int LAYER_7( 0x80000000 >> 6 ); - +#endif bool @@ -126,13 +128,14 @@ FltExportVisitor::writeFace( const osg::Geode& geode, const osg::Geometry& geom, POINT_ROTATE_WITH_ALPHA_BLENDING = 4 }; - const unsigned int TERRAIN_BIT = 0x80000000u >> 0; - const unsigned int NO_COLOR_BIT = 0x80000000u >> 1; - const unsigned int NO_ALT_COLOR_BIT = 0x80000000u >> 2; + // const unsigned int TERRAIN_BIT = 0x80000000u >> 0; + // const unsigned int NO_COLOR_BIT = 0x80000000u >> 1; + // const unsigned int NO_ALT_COLOR_BIT = 0x80000000u >> 2; const unsigned int PACKED_COLOR_BIT = 0x80000000u >> 3; - const unsigned int FOOTPRINT_BIT = 0x80000000u >> 4; // Terrain culture cutout + // const unsigned int FOOTPRINT_BIT = 0x80000000u >> 4; // Terrain culture cutout const unsigned int HIDDEN_BIT = 0x80000000u >> 5; - const unsigned int ROOFLINE_BIT = 0x80000000u >> 6; + // const unsigned int ROOFLINE_BIT = 0x80000000u >> 6; + uint32 flags( PACKED_COLOR_BIT ); if (geode.getNodeMask() == 0) flags |= HIDDEN_BIT; @@ -175,7 +178,7 @@ FltExportVisitor::writeFace( const osg::Geode& geode, const osg::Geometry& geom, (int)(packedColorRaw[0]*255); - int8 drawType; + int8 drawType = SOLID_NO_BACKFACE; switch( mode ) { @@ -305,7 +308,7 @@ FltExportVisitor::writeFace( const osg::Geode& geode, const osg::Geometry& geom, _records->writeInt32( -1 ); // Alternate color index // Next four bytes: // 15.8: two 2-byte "reserved" fields - // 15.9: one 4-byte "reserved" field + // 15.9: one 4-byte "reserved" field; _records->writeInt16( 0 ); // Reserved _records->writeInt16( -1 ); // Shader index } @@ -333,13 +336,13 @@ FltExportVisitor::writeMesh( const osg::Geode& geode, const osg::Geometry& geom POINT_ROTATE_WITH_ALPHA_BLENDING = 4 }; - const unsigned int TERRAIN_BIT = 0x80000000u >> 0; - const unsigned int NO_COLOR_BIT = 0x80000000u >> 1; - const unsigned int NO_ALT_COLOR_BIT = 0x80000000u >> 2; + // const unsigned int TERRAIN_BIT = 0x80000000u >> 0; + //const unsigned int NO_COLOR_BIT = 0x80000000u >> 1; + //const unsigned int NO_ALT_COLOR_BIT = 0x80000000u >> 2; const unsigned int PACKED_COLOR_BIT = 0x80000000u >> 3; - const unsigned int FOOTPRINT_BIT = 0x80000000u >> 4; // Terrain culture cutout + //const unsigned int FOOTPRINT_BIT = 0x80000000u >> 4; // Terrain culture cutout const unsigned int HIDDEN_BIT = 0x80000000u >> 5; - const unsigned int ROOFLINE_BIT = 0x80000000u >> 6; + //const unsigned int ROOFLINE_BIT = 0x80000000u >> 6; uint32 flags( PACKED_COLOR_BIT ); if (geode.getNodeMask() == 0) flags |= HIDDEN_BIT; @@ -558,7 +561,7 @@ FltExportVisitor::writeLocalVertexPool( const osg::Geometry& geom ) { // Attribute Mask static const unsigned int HAS_POSITION = 0x80000000u >> 0; - static const unsigned int HAS_COLOR_INDEX = 0x80000000u >> 1; + // static const unsigned int HAS_COLOR_INDEX = 0x80000000u >> 1; static const unsigned int HAS_RGBA_COLOR = 0x80000000u >> 2; static const unsigned int HAS_NORMAL = 0x80000000u >> 3; static const unsigned int HAS_BASE_UV = 0x80000000u >> 4; @@ -790,7 +793,7 @@ FltExportVisitor::writeUVList( int numVerts, const osg::Geometry& geom ) _records->writeInt32( flags ); osg::Vec2 defaultCoord( 0., 0. ); - const osg::StateSet* ss = getCurrentStateSet(); + // const osg::StateSet* ss = getCurrentStateSet(); for( idx=1; idx<8; idx++) { if( isTextured( idx, geom ) ) @@ -805,7 +808,7 @@ FltExportVisitor::writeUVList( int numVerts, const osg::Geometry& geom ) _fltOpt->getWriteResult().warn( warning.str() ); t2 = new osg::Vec2Array; } - else if (t2->getNumElements() != numVerts) + else if (static_cast(t2->getNumElements()) != numVerts) { std::ostringstream warning; warning << "fltexp: Invalid number of texture coordinates for unit " << idx; diff --git a/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp b/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp index bcd4d3a19..9c87df736 100644 --- a/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp +++ b/src/osgPlugins/OpenFlight/expPrimaryRecords.cpp @@ -87,8 +87,8 @@ FltExportVisitor::writeHeader( const std::string& headerName ) } static const unsigned int SAVE_VERTEX_NORMALS_BIT = 0x80000000u >> 0; - static const unsigned int PACKED_COLOR_MODE_BIT = 0x80000000u >> 1; - static const unsigned int CAD_VIEW_MODE_BIT = 0x80000000u >> 2; + //static const unsigned int PACKED_COLOR_MODE_BIT = 0x80000000u >> 1; + //static const unsigned int CAD_VIEW_MODE_BIT = 0x80000000u >> 2; uint32 flags( SAVE_VERTEX_NORMALS_BIT ); IdHelper id(*this, headerName);