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:
@@ -359,7 +359,7 @@ Vec3 Camera::getSideVector() const
|
||||
}
|
||||
|
||||
|
||||
void Camera::attachTransform(TransformMode mode, Matrix* matrix)
|
||||
void Camera::attachTransform(TransformMode mode, RefMatrix* matrix)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
@@ -369,7 +369,7 @@ void Camera::attachTransform(TransformMode mode, Matrix* matrix)
|
||||
if (_eyeToModelTransform.valid())
|
||||
{
|
||||
_attachedTransformMode = mode;
|
||||
if (!_modelToEyeTransform.valid()) _modelToEyeTransform = new Matrix;
|
||||
if (!_modelToEyeTransform.valid()) _modelToEyeTransform = new RefMatrix;
|
||||
if (!_modelToEyeTransform->invert(*_eyeToModelTransform))
|
||||
{
|
||||
notify(WARN)<<"Warning: Camera::attachTransform() failed to invert _modelToEyeTransform"<<std::endl;
|
||||
@@ -388,7 +388,7 @@ void Camera::attachTransform(TransformMode mode, Matrix* matrix)
|
||||
if (_modelToEyeTransform.valid())
|
||||
{
|
||||
_attachedTransformMode = mode;
|
||||
if (!_eyeToModelTransform.valid()) _eyeToModelTransform = new Matrix;
|
||||
if (!_eyeToModelTransform.valid()) _eyeToModelTransform = new RefMatrix;
|
||||
if (!_eyeToModelTransform->invert(*_modelToEyeTransform))
|
||||
{
|
||||
notify(WARN)<<"Warning: Camera::attachTransform() failed to invert _modelToEyeTransform"<<std::endl;
|
||||
|
||||
Reference in New Issue
Block a user