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:
@@ -5,6 +5,8 @@
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include "Matrix.h"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
@@ -27,11 +29,10 @@ bool Projection_readLocalData(Object& obj, Input& fr)
|
||||
Projection &myobj = static_cast<Projection &>(obj);
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
static Matrix s_matrix;
|
||||
|
||||
if (Matrix* tmpMatrix = static_cast<Matrix*>(fr.readObjectOfType(s_matrix)))
|
||||
Matrix matrix;
|
||||
if (readMatrix(matrix,fr))
|
||||
{
|
||||
myobj.setMatrix(*tmpMatrix);
|
||||
myobj.setMatrix(matrix);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
@@ -43,7 +44,7 @@ bool Projection_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Projection& myobj = static_cast<const Projection&>(obj);
|
||||
|
||||
fw.writeObject(myobj.getMatrix());
|
||||
writeMatrix(myobj.getMatrix(),fw);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user