Create a separate scenemanager for each CharacterPreview instance

actorid
Jordan Milne 12 years ago
parent 39d27b87c9
commit 857bb42297

@ -67,7 +67,7 @@ namespace MWGui
setCoord(0, 342, 498, 258);
MWBase::Environment::get().getWorld ()->setupExternalRendering (mPreview);
mPreview.setup();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
openContainer(player);

@ -106,7 +106,7 @@ void RaceDialog::open()
updateSpellPowers();
mPreview = new MWRender::RaceSelectionPreview();
MWBase::Environment::get().getWorld ()->setupExternalRendering (*mPreview);
mPreview->setup();
mPreview->update (0);
const ESM::NPC proto = mPreview->getPrototype();

@ -2,6 +2,7 @@
#include <OgreSceneManager.h>
#include <OgreRoot.h>
#include <OgreHardwarePixelBuffer.h>
#include <libs/openengine/ogre/selectionbuffer.hpp>
@ -35,13 +36,18 @@ namespace MWRender
}
void CharacterPreview::setup (Ogre::SceneManager *sceneManager)
void CharacterPreview::setup ()
{
mSceneMgr = sceneManager;
mSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
mCamera = mSceneMgr->createCamera (mName);
mCamera->setAspectRatio (float(mSizeX) / float(mSizeY));
mNode = static_cast<Ogre::SceneNode*>(mSceneMgr->getRootSceneNode()->getChild("mwRoot"))->createChildSceneNode ();
Ogre::SceneNode* renderRoot = mSceneMgr->getRootSceneNode()->createChildSceneNode("renderRoot");
//we do this with mwRoot in renderingManager, do it here too.
renderRoot->pitch(Ogre::Degree(-90));
mNode = renderRoot->createChildSceneNode();
mAnimation = new NpcAnimation(mCharacter, mNode,
MWWorld::Class::get(mCharacter).getInventoryStore (mCharacter), RV_PlayerPreview);
@ -79,6 +85,7 @@ namespace MWRender
//Ogre::TextureManager::getSingleton().remove(mName);
mSceneMgr->destroyCamera (mName);
delete mAnimation;
Ogre::Root::getSingleton().destroySceneManager(mSceneMgr);
}
void CharacterPreview::rebuild()

@ -23,14 +23,14 @@ namespace MWRender
class NpcAnimation;
class CharacterPreview : public ExternalRendering
class CharacterPreview
{
public:
CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name,
Ogre::Vector3 position, Ogre::Vector3 lookAt);
virtual ~CharacterPreview();
virtual void setup (Ogre::SceneManager *sceneManager);
virtual void setup ();
virtual void onSetup();
virtual void rebuild();

Loading…
Cancel
Save