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,14 +5,12 @@ using namespace osg;
|
||||
MatrixTransform::MatrixTransform():
|
||||
_inverseDirty(false)
|
||||
{
|
||||
_matrix = new Matrix;
|
||||
_inverse = new Matrix;
|
||||
}
|
||||
|
||||
MatrixTransform::MatrixTransform(const MatrixTransform& transform,const CopyOp& copyop):
|
||||
Transform(transform,copyop),
|
||||
_matrix(new Matrix(*transform._matrix)),
|
||||
_inverse(new Matrix(*transform._inverse)),
|
||||
_matrix(transform._matrix),
|
||||
_inverse(transform._inverse),
|
||||
_inverseDirty(transform._inverseDirty)
|
||||
{
|
||||
}
|
||||
@@ -21,8 +19,7 @@ MatrixTransform::MatrixTransform(const Matrix& mat )
|
||||
{
|
||||
_referenceFrame = RELATIVE_TO_PARENTS;
|
||||
|
||||
_matrix = new Matrix(mat);
|
||||
_inverse = new Matrix();
|
||||
_matrix = mat;
|
||||
_inverseDirty = false;
|
||||
}
|
||||
|
||||
@@ -35,11 +32,11 @@ bool MatrixTransform::computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) con
|
||||
{
|
||||
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
||||
{
|
||||
matrix.preMult(*_matrix);
|
||||
matrix.preMult(_matrix);
|
||||
}
|
||||
else // absolute
|
||||
{
|
||||
matrix = *_matrix;
|
||||
matrix = _matrix;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user