mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +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:
|
||||
CopyFramebufferToTextureCallback(osg::Texture2D* texture)
|
||||
: mTexture(texture)
|
||||
, oneshot(true)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void operator () (osg::RenderInfo& renderInfo) const
|
||||
{
|
||||
if (!oneshot)
|
||||
return;
|
||||
oneshot = false;
|
||||
int w = renderInfo.getCurrentCamera()->getViewport()->width();
|
||||
int h = renderInfo.getCurrentCamera()->getViewport()->height();
|
||||
mTexture->copyTexImage2D(*renderInfo.getState(), 0, 0, w, h);
|
||||
|
@ -145,6 +149,7 @@ namespace MWGui
|
|||
|
||||
private:
|
||||
osg::ref_ptr<osg::Texture2D> mTexture;
|
||||
mutable bool oneshot;
|
||||
};
|
||||
|
||||
class DontComputeBoundCallback : public osg::Node::ComputeBoundingSphereCallback
|
||||
|
|
Loading…
Reference in a new issue