Improved the handling of matrices in serialization so that it's more reliable,
change was to use doubles for reading and writing matrices regardless of type of Matrix being serialized. Change does break backwards compatibility though, so code path supporting original format has been left in for the time being. However, this code is not reliable enough and is over complicated compared to the simplified handling. Once the new code has been bedded down for a while I'll remove this code block.
This commit is contained in:
@@ -336,14 +336,17 @@ public:
|
||||
|
||||
virtual bool write( OutputStream& os, const osg::Object& obj )
|
||||
{
|
||||
|
||||
const C& object = OBJECT_CAST<const C&>(obj);
|
||||
const osg::Matrix& value = (object.*_getter)();
|
||||
if ( os.isBinary() )
|
||||
{
|
||||
OSG_NOTICE<<"MatrixSerializer::write() binary"<<std::endl;
|
||||
os << value;
|
||||
}
|
||||
else if ( ParentType::_defaultValue!=value )
|
||||
{
|
||||
OSG_NOTICE<<"MatrixSerializer::write() ascii, ParentType::_name="<<ParentType::_name<<std::endl;
|
||||
os << PROPERTY((ParentType::_name).c_str()) << value << std::endl;
|
||||
}
|
||||
return true;
|
||||
@@ -352,6 +355,9 @@ public:
|
||||
protected:
|
||||
void readMatrixImplementation( InputStream& is, osg::Matrix& matrix )
|
||||
{
|
||||
#if 1
|
||||
is >> matrix;
|
||||
#else
|
||||
if ( is.getUseFloatMatrix() )
|
||||
{
|
||||
osg::Matrixf realValue; is >> realValue;
|
||||
@@ -362,6 +368,7 @@ protected:
|
||||
osg::Matrixd realValue; is >> realValue;
|
||||
matrix = realValue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user