From Wojciech Lewandowski, "I did few tests to see whether adding PreDraw callback would help us with SPI problems when using Viewer. Results were positive so I decided to give it a try and ask you to verify and maybe merge with existing codebase.
I added _preDrawCallback member and neccessary access methods plus modified osgUtil RenderStage.cpp to invoke it before all drawInner calls are made. I tried to maintain symmetry with postDrawCallback but you know better where is a proper place for this call ;-) "
This commit is contained in:
@@ -52,6 +52,7 @@ Camera::Camera(const Camera& camera,const CopyOp& copyop):
|
||||
_renderTargetImplementation(camera._renderTargetImplementation),
|
||||
_renderTargetFallback(camera._renderTargetFallback),
|
||||
_bufferAttachmentMap(camera._bufferAttachmentMap),
|
||||
_preDrawCallback(camera._preDrawCallback),
|
||||
_postDrawCallback(camera._postDrawCallback)
|
||||
{
|
||||
// need to copy/share graphics context?
|
||||
|
||||
@@ -864,6 +864,12 @@ void RenderStage::draw(osg::RenderInfo& renderInfo,RenderLeaf*& previous)
|
||||
|
||||
if (!useThread) useContext->makeCurrent();
|
||||
}
|
||||
|
||||
if (_camera && _camera->getPreDrawCallback())
|
||||
{
|
||||
// if we have a camera with a post draw callback invoke it.
|
||||
(*(_camera->getPreDrawCallback()))(*_camera);
|
||||
}
|
||||
|
||||
bool doCopyTexture = _texture.valid() ?
|
||||
(callingContext != useContext) :
|
||||
|
||||
Reference in New Issue
Block a user