Added Camera::dirtyAttachmentMap(), Camera::s/getAttachmentMapModified() value and usage of this in RenderStage as a new mechanism

for telling the rendering backend to update itself to reflect new values in the attachments such as new texture or image sizes.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14808 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2015-03-31 10:36:38 +00:00
parent 06e6f368fc
commit 307e70f13b
4 changed files with 28 additions and 2 deletions

View File

@@ -416,6 +416,16 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
const BufferAttachmentMap& getBufferAttachmentMap() const { return _bufferAttachmentMap; }
/** Increment the _attachementMapModifiedCount so that the rendering backend will know that it needs to be updated to handle any new settings (such as format change/resizes.).*/
void dirtyAttachmentMap() { ++_attachmentMapModifiedCount; }
/** Set the AttachmentMapModifiedCount to a specific value. Note, normal usage you would simply call dirtyAttachmentMap(). */
void setAttachmentMapModifiedCount(unsigned int v) { _attachmentMapModifiedCount = v; }
/** Get the AttachmentMapModifiedCount. */
unsigned int getAttachmentMapModifiedCount() const { return _attachmentMapModifiedCount; }
/** Explicit control over implicit allocation of buffers when using FBO.
Implicit buffers are automatically substituted when user have not attached such buffer.
@@ -667,6 +677,8 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
ImplicitBufferAttachmentMask _implicitBufferAttachmentRenderMask;
ImplicitBufferAttachmentMask _implicitBufferAttachmentResolveMask;
unsigned int _attachmentMapModifiedCount;
ref_ptr<OperationThread> _cameraThread;
ref_ptr<GraphicsContext> _graphicsContext;

View File

@@ -143,6 +143,10 @@ class OSGUTIL_EXPORT RenderStage : public RenderBin
void setCameraRequiresSetUp(bool flag) { _cameraRequiresSetUp = flag; }
bool getCameraRequiresSetUp() const { return _cameraRequiresSetUp; }
void setCameraAttachmentMapCount(unsigned int v) { _cameraAttachmentMapModifiedCount = v; }
unsigned int getCameraAttachmentMapCount() { return _cameraAttachmentMapModifiedCount; }
/** Attempt the set the RenderStage from the Camera settings.*/
void runCameraSetUp(osg::RenderInfo& renderInfo);
@@ -288,6 +292,7 @@ protected:
int _clearStencil;
bool _cameraRequiresSetUp;
unsigned int _cameraAttachmentMapModifiedCount;
osg::observer_ptr<osg::Camera> _camera;
osg::ref_ptr<osg::Texture> _texture;