Added Camera's s/getCameraThread() and updated wrappers

This commit is contained in:
Robert Osfield
2007-02-05 13:44:16 +00:00
parent ea67cc7a50
commit ebd68ba063
6 changed files with 76 additions and 1 deletions

View File

@@ -56,6 +56,8 @@ Camera::Camera(const Camera& camera,const CopyOp& copyop):
Camera::~Camera()
{
setCameraThread(0);
if (_graphicsContext.valid()) _graphicsContext->removeCamera(this);
}
@@ -301,3 +303,31 @@ bool Camera::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
return true;
}
void Camera::createCameraThread()
{
if (!_cameraThread)
{
setCameraThread(new OperationsThread);
}
}
void Camera::setCameraThread(OperationsThread* gt)
{
if (_cameraThread==gt) return;
if (_cameraThread.valid())
{
// need to kill the thread in some way...
_cameraThread->cancel();
_cameraThread->setParent(0);
}
_cameraThread = gt;
if (_cameraThread.valid())
{
_cameraThread->setParent(this);
}
}

View File

@@ -14,6 +14,7 @@
#include <osg/ColorMask>
#include <osg/CopyOp>
#include <osg/GraphicsContext>
#include <osg/GraphicsThread>
#include <osg/Image>
#include <osg/Matrix>
#include <osg/Matrixd>
@@ -329,6 +330,22 @@ BEGIN_OBJECT_REFLECTOR(osg::Camera)
__C5_BufferAttachmentMap_R1__getBufferAttachmentMap,
"Get the const BufferAttachmentMap, used to configure frame buffer objects, pbuffers and texture reads. ",
"");
I_Method0(void, createCameraThread,
__void__createCameraThread,
"Create a operation thread for this camera. ",
"");
I_Method1(void, setCameraThread, IN, osg::OperationsThread *, gt,
__void__setCameraThread__OperationsThread_P1,
"Assign a operation thread to the camera. ",
"");
I_Method0(osg::OperationsThread *, getCameraThread,
__OperationsThread_P1__getCameraThread,
"Get the operation thread assigned to this camera. ",
"");
I_Method0(const osg::OperationsThread *, getCameraThread,
__C5_OperationsThread_P1__getCameraThread,
"Get the const operation thread assigned to this camera. ",
"");
I_Method1(void, setGraphicsContext, IN, osg::GraphicsContext *, context,
__void__setGraphicsContext__GraphicsContext_P1,
"Set the GraphicsContext that provides the mechansim for managing the OpenGL graphics context associated with this camera. ",
@@ -388,6 +405,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Camera)
I_SimpleProperty(osg::Camera::BufferAttachmentMap &, BufferAttachmentMap,
__BufferAttachmentMap_R1__getBufferAttachmentMap,
0);
I_SimpleProperty(osg::OperationsThread *, CameraThread,
__OperationsThread_P1__getCameraThread,
__void__setCameraThread__OperationsThread_P1);
I_SimpleProperty(const osg::Vec4 &, ClearColor,
__C5_Vec4_R1__getClearColor,
__void__setClearColor__C5_Vec4_R1);

View File

@@ -25,7 +25,7 @@ TYPE_NAME_ALIAS(std::pair< int COMMA const osg::Referenced * >, osg::DeleteHand
TYPE_NAME_ALIAS(std::list< osg::DeleteHandler::FrameNumberObjectPair >, osg::DeleteHandler::ObjectsToDeleteList);
BEGIN_VALUE_REFLECTOR(osg::DeleteHandler)
BEGIN_OBJECT_REFLECTOR(osg::DeleteHandler)
I_ConstructorWithDefaults1(IN, int, numberOfFramesToRetainObjects, 0,
____DeleteHandler__int,
"",