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

@@ -35,7 +35,8 @@ Camera::Camera():
_renderTargetImplementation(FRAME_BUFFER),
_renderTargetFallback(FRAME_BUFFER),
_implicitBufferAttachmentRenderMask( USE_DISPLAY_SETTINGS_MASK ),
_implicitBufferAttachmentResolveMask( USE_DISPLAY_SETTINGS_MASK )
_implicitBufferAttachmentResolveMask( USE_DISPLAY_SETTINGS_MASK ),
_attachmentMapModifiedCount(0)
{
setStateSet(new StateSet);
}
@@ -66,6 +67,7 @@ Camera::Camera(const Camera& camera,const CopyOp& copyop):
_bufferAttachmentMap(camera._bufferAttachmentMap),
_implicitBufferAttachmentRenderMask(camera._implicitBufferAttachmentRenderMask),
_implicitBufferAttachmentResolveMask(camera._implicitBufferAttachmentResolveMask),
_attachmentMapModifiedCount(camera._attachmentMapModifiedCount),
_initialDrawCallback(camera._initialDrawCallback),
_preDrawCallback(camera._preDrawCallback),
_postDrawCallback(camera._postDrawCallback),

View File

@@ -53,6 +53,7 @@ RenderStage::RenderStage():
_clearStencil = 0;
_cameraRequiresSetUp = false;
_cameraAttachmentMapModifiedCount = 0;
_camera = 0;
_level = 0;
@@ -83,6 +84,7 @@ RenderStage::RenderStage(SortMode mode):
_clearStencil = 0;
_cameraRequiresSetUp = false;
_cameraAttachmentMapModifiedCount = 0;
_camera = 0;
_level = 0;
@@ -109,6 +111,7 @@ RenderStage::RenderStage(const RenderStage& rhs,const osg::CopyOp& copyop):
_clearDepth(rhs._clearDepth),
_clearStencil(rhs._clearStencil),
_cameraRequiresSetUp(rhs._cameraRequiresSetUp),
_cameraAttachmentMapModifiedCount(rhs._cameraAttachmentMapModifiedCount),
_camera(rhs._camera),
_level(rhs._level),
_face(rhs._face),
@@ -227,6 +230,10 @@ void RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo)
if (!_camera) return;
OSG_INFO<<"RenderStage::runCameraSetUp(osg::RenderInfo& renderInfo) "<<this<<std::endl;
_cameraAttachmentMapModifiedCount = _camera->getAttachmentMapModifiedCount();
osg::State& state = *renderInfo.getState();
osg::Camera::RenderTargetImplementation renderTargetImplementation = _camera->getRenderTargetImplementation();
@@ -1160,7 +1167,7 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous)
// so there is no need to call it here.
drawPreRenderStages(renderInfo,previous);
if (_cameraRequiresSetUp)
if (_cameraRequiresSetUp || (_cameraAttachmentMapModifiedCount!=_camera->getAttachmentMapModifiedCount()))
{
runCameraSetUp(renderInfo);
}