mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 02:15:32 +00:00
Avoid calling RenderTarget::update from within loadResource
This commit is contained in:
parent
8c26f802e6
commit
4a26dcb2ad
4 changed files with 29 additions and 5 deletions
|
@ -504,6 +504,7 @@ namespace MWGui
|
|||
|
||||
void InventoryWindow::doRenderUpdate ()
|
||||
{
|
||||
mPreview->onFrame();
|
||||
if (mPreviewDirty)
|
||||
{
|
||||
mPreviewDirty = false;
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace MWRender
|
|||
, mViewport(NULL)
|
||||
, mCamera(NULL)
|
||||
, mNode(NULL)
|
||||
, mRecover(false)
|
||||
{
|
||||
mCharacter.mCell = NULL;
|
||||
}
|
||||
|
@ -46,6 +47,16 @@ namespace MWRender
|
|||
|
||||
}
|
||||
|
||||
void CharacterPreview::onFrame()
|
||||
{
|
||||
if (mRecover)
|
||||
{
|
||||
setupRenderTarget();
|
||||
mRenderTarget->update();
|
||||
mRecover = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterPreview::setup ()
|
||||
{
|
||||
mSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
|
||||
|
@ -127,9 +138,9 @@ namespace MWRender
|
|||
|
||||
tex->createInternalResources();
|
||||
|
||||
setupRenderTarget();
|
||||
|
||||
mRenderTarget->update();
|
||||
mRenderTarget = NULL;
|
||||
mViewport = NULL;
|
||||
mRecover = true;
|
||||
}
|
||||
|
||||
void CharacterPreview::setupRenderTarget()
|
||||
|
@ -223,6 +234,10 @@ namespace MWRender
|
|||
|
||||
mViewport->setDimensions (0, 0, std::min(1.f, float(mSizeX) / float(512)), std::min(1.f, float(mSizeY) / float(1024)));
|
||||
mTexture->load();
|
||||
|
||||
if (!mRenderTarget)
|
||||
setupRenderTarget();
|
||||
|
||||
mRenderTarget->update();
|
||||
|
||||
mSelectionBuffer->update();
|
||||
|
|
|
@ -34,8 +34,13 @@ namespace MWRender
|
|||
|
||||
virtual void rebuild();
|
||||
|
||||
void onFrame();
|
||||
|
||||
void loadResource(Ogre::Resource *resource);
|
||||
|
||||
private:
|
||||
bool mRecover; // Texture content was lost and needs to be re-rendered
|
||||
|
||||
private:
|
||||
CharacterPreview(const CharacterPreview&);
|
||||
CharacterPreview& operator=(const CharacterPreview&);
|
||||
|
|
|
@ -51,9 +51,9 @@ namespace Render
|
|||
|
||||
tex->createInternalResources();
|
||||
|
||||
setupRenderTarget();
|
||||
mRenderTarget = NULL;
|
||||
|
||||
mRenderTarget->update();
|
||||
// Don't need to re-render texture, because we have a copy in system memory (mBuffer)
|
||||
}
|
||||
|
||||
SelectionBuffer::~SelectionBuffer()
|
||||
|
@ -65,6 +65,9 @@ namespace Render
|
|||
{
|
||||
Ogre::MaterialManager::getSingleton ().addListener (this);
|
||||
|
||||
if (mRenderTarget == NULL)
|
||||
setupRenderTarget();
|
||||
|
||||
mRenderTarget->update();
|
||||
|
||||
Ogre::MaterialManager::getSingleton ().removeListener (this);
|
||||
|
|
Loading…
Reference in a new issue