diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index fc8c24484..6a6c596be 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -238,6 +238,12 @@ namespace MWGui } } + void CharacterCreation::doRenderUpdate() + { + if (mRaceDialog) + mRaceDialog->doRenderUpdate(); + } + void CharacterCreation::setPlayerHealth (const MWMechanics::DynamicStat& value) { mPlayerHealth = value; diff --git a/apps/openmw/mwgui/charactercreation.hpp b/apps/openmw/mwgui/charactercreation.hpp index 586faf966..bd8826677 100644 --- a/apps/openmw/mwgui/charactercreation.hpp +++ b/apps/openmw/mwgui/charactercreation.hpp @@ -41,6 +41,7 @@ namespace MWGui void setValue (const std::string& id, const MWMechanics::DynamicStat& value); void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat& value); void configureSkills (const SkillList& major, const SkillList& minor); + void doRenderUpdate(); private: //Dialogs diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index 9065333f5..ba06c8d10 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -32,6 +32,7 @@ namespace MWGui , mFaceIndex(0) , mHairIndex(0) , mCurrentAngle(0) + , mPreviewDirty(true) { // Centre dialog center(); @@ -126,6 +127,8 @@ namespace MWGui mHairIndex = boost::lexical_cast(index) - 1; mPreviewImage->setImageTexture ("CharacterHeadPreview"); + + mPreviewDirty = true; } @@ -174,6 +177,7 @@ namespace MWGui float angle = (float(_position) / 49.f - 0.5) * 3.14 * 2; float diff = angle - mCurrentAngle; mPreview->update (diff); + mPreviewDirty = true; mCurrentAngle += diff; } @@ -286,6 +290,16 @@ namespace MWGui record.mHair = mAvailableHairs[mHairIndex]; mPreview->setPrototype(record); + mPreviewDirty = true; + } + + void RaceDialog::doRenderUpdate() + { + if (mPreviewDirty) + { + mPreview->render(); + mPreviewDirty = false; + } } void RaceDialog::updateRaces() diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index 1d48c67cd..914ae8096 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -52,6 +52,8 @@ namespace MWGui */ EventHandle_Void eventBack; + void doRenderUpdate(); + protected: void onHeadRotate(MyGUI::ScrollBar* _sender, size_t _position); @@ -98,6 +100,8 @@ namespace MWGui float mCurrentAngle; MWRender::RaceSelectionPreview* mPreview; + + bool mPreviewDirty; }; } #endif diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index f20f03611..0d40bc2be 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1292,6 +1292,7 @@ namespace MWGui void WindowManager::frameStarted (float dt) { mInventoryWindow->doRenderUpdate (); + mCharGen->doRenderUpdate(); } void WindowManager::updatePlayer() diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index e4bba289f..e9ecedc55 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -230,7 +230,10 @@ namespace MWRender mNode->roll(Ogre::Radian(angle), Ogre::SceneNode::TS_LOCAL); updateCamera(); + } + void RaceSelectionPreview::render() + { mRenderTarget->update(); } diff --git a/apps/openmw/mwrender/characterpreview.hpp b/apps/openmw/mwrender/characterpreview.hpp index 562cb3784..b2dfc9679 100644 --- a/apps/openmw/mwrender/characterpreview.hpp +++ b/apps/openmw/mwrender/characterpreview.hpp @@ -93,6 +93,7 @@ namespace MWRender RaceSelectionPreview(); virtual void onSetup(); + void render(); void update(float angle);