Added Camera's s/getCameraThread() and updated wrappers
This commit is contained in:
parent
ea67cc7a50
commit
ebd68ba063
@ -299,6 +299,11 @@ configure reflector "osgDB::ReadWriteMutex"
|
||||
object-type
|
||||
end
|
||||
|
||||
|
||||
configure reflector "osg::DeleteHandler"
|
||||
object-type
|
||||
end
|
||||
|
||||
#############################################################################
|
||||
|
||||
# Doxygen doesn't parse ReadFunc and WriteFunc correctly...
|
||||
|
@ -318,6 +318,20 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
|
||||
const BufferAttachmentMap& getBufferAttachmentMap() const { return _bufferAttachmentMap; }
|
||||
|
||||
|
||||
/** Create a operation thread for this camera.*/
|
||||
void createCameraThread();
|
||||
|
||||
/** Assign a operation thread to the camera.*/
|
||||
void setCameraThread(OperationsThread* gt);
|
||||
|
||||
/** Get the operation thread assigned to this camera.*/
|
||||
OperationsThread* getCameraThread() { return _cameraThread.get(); }
|
||||
|
||||
/** Get the const operation thread assigned to this camera.*/
|
||||
const OperationsThread* getCameraThread() const { return _cameraThread.get(); }
|
||||
|
||||
|
||||
|
||||
/** Set the GraphicsContext that provides the mechansim for managing the OpenGL graphics context associated with this camera.*/
|
||||
void setGraphicsContext(GraphicsContext* context);
|
||||
|
||||
@ -407,7 +421,10 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
|
||||
RenderTargetImplementation _renderTargetFallback;
|
||||
BufferAttachmentMap _bufferAttachmentMap;
|
||||
|
||||
ref_ptr<OperationsThread> _cameraThread;
|
||||
|
||||
ref_ptr<GraphicsContext> _graphicsContext;
|
||||
|
||||
buffered_object< ref_ptr<Object> > _renderingCache;
|
||||
|
||||
ref_ptr<DrawCallback> _postDrawCallback;
|
||||
|
@ -71,6 +71,9 @@ class OSG_EXPORT DeleteHandler
|
||||
|
||||
protected:
|
||||
|
||||
DeleteHandler(const DeleteHandler&) {}
|
||||
DeleteHandler operator = (const DeleteHandler&) { return *this; }
|
||||
|
||||
int _numFramesToRetainObjects;
|
||||
int _currentFrameNumber;
|
||||
OpenThreads::Mutex _mutex;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
"",
|
||||
|
Loading…
Reference in New Issue
Block a user