From b3f0479118800633e4909f0d7b3fa06d365c6d75 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 24 Jun 2013 08:22:50 +0000 Subject: [PATCH] From Wang Rui, "Sorry for my very slow response because of some personal issues. I found that new Geometry serializers can't work with old .osgb files. The modified FastPathHint serializer doesn't correctly read from the stream and thus jumbles following inputs. The file attached can be placed in osgWrappers/serializers/osg to fix that problem. " --- src/osgWrappers/serializers/osg/Geometry.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/osgWrappers/serializers/osg/Geometry.cpp b/src/osgWrappers/serializers/osg/Geometry.cpp index 093b3c8dd..d77926fd6 100644 --- a/src/osgWrappers/serializers/osg/Geometry.cpp +++ b/src/osgWrappers/serializers/osg/Geometry.cpp @@ -124,15 +124,14 @@ struct GeometryFinishedObjectReadCallback : public osgDB::FinishedObjectReadCall static bool checkFastPathHint( const osg::Geometry& geom ) { return false; } static bool readFastPathHint( osgDB::InputStream& is, osg::Geometry& geom ) { + // Compatibility info: + // Previous Geometry wrapper (before 3.1.8) require a bool fast-path serializer. + // It saves "FastPathHint true" in ascii mode and a single [bool] in binary mode. + // Becoming a user serializer, the serializer will first read the name "FastPathHint" + // or a [bool] in the checking process, then call the reading function as here. So, + // we will only need to read one more bool variable in ascii mode; otherwise do nothing bool value = false; - if ( is.isBinary() ) - { - is >> value; - } - else if ( is.matchString("FastPathHint") ) - { - is >> value; - } + if ( !is.isBinary() ) is >> value; return true; } static bool writeFastPathHint( osgDB::OutputStream& os, const osg::Geometry& geom )