Made the more of the OSG's referenced object desctructors protected to ensure
that they arn't created on the stack inappropriately. Split the implemention of Matrix up so that it is a simple no referenced counted class and can be safefly created on the stack. To support referenced counting a seperate subclass now exists, this is RefMatrix which inherits from both Matrix and Object.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include "Matrix.h"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
@@ -54,17 +56,12 @@ bool MatrixTransform_readLocalData(Object& obj, Input& fr)
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static Matrix s_matrix;
|
||||
}
|
||||
|
||||
if (Matrix* tmpMatrix = static_cast<Matrix*>(fr.readObjectOfType(s_matrix)))
|
||||
Matrix matrix;
|
||||
if (readMatrix(matrix,fr))
|
||||
{
|
||||
|
||||
transform.setMatrix(*tmpMatrix);
|
||||
|
||||
delete tmpMatrix;
|
||||
|
||||
transform.setMatrix(matrix);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
@@ -76,7 +73,7 @@ bool MatrixTransform_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const MatrixTransform& transform = static_cast<const MatrixTransform&>(obj);
|
||||
|
||||
fw.writeObject(transform.getMatrix());
|
||||
writeMatrix(transform.getMatrix(),fw);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user