mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 22:36:43 +00:00
Make sure CopyFramebufferToTextureCallback is only called once and not every frame
This commit is contained in:
parent
8e7c01b561
commit
1bdec2399f
1 changed files with 5 additions and 0 deletions
|
@ -133,11 +133,15 @@ namespace MWGui
|
||||||
public:
|
public:
|
||||||
CopyFramebufferToTextureCallback(osg::Texture2D* texture)
|
CopyFramebufferToTextureCallback(osg::Texture2D* texture)
|
||||||
: mTexture(texture)
|
: mTexture(texture)
|
||||||
|
, oneshot(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
virtual void operator () (osg::RenderInfo& renderInfo) const
|
||||||
{
|
{
|
||||||
|
if (!oneshot)
|
||||||
|
return;
|
||||||
|
oneshot = false;
|
||||||
int w = renderInfo.getCurrentCamera()->getViewport()->width();
|
int w = renderInfo.getCurrentCamera()->getViewport()->width();
|
||||||
int h = renderInfo.getCurrentCamera()->getViewport()->height();
|
int h = renderInfo.getCurrentCamera()->getViewport()->height();
|
||||||
mTexture->copyTexImage2D(*renderInfo.getState(), 0, 0, w, h);
|
mTexture->copyTexImage2D(*renderInfo.getState(), 0, 0, w, h);
|
||||||
|
@ -145,6 +149,7 @@ namespace MWGui
|
||||||
|
|
||||||
private:
|
private:
|
||||||
osg::ref_ptr<osg::Texture2D> mTexture;
|
osg::ref_ptr<osg::Texture2D> mTexture;
|
||||||
|
mutable bool oneshot;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DontComputeBoundCallback : public osg::Node::ComputeBoundingSphereCallback
|
class DontComputeBoundCallback : public osg::Node::ComputeBoundingSphereCallback
|
||||||
|
|
Loading…
Reference in a new issue