CharacterPreview no longer depends on osgViewer

coverity_scan^2
scrawl 8 years ago
parent 8bfcf259a3
commit dda5bfbc9f

@ -62,8 +62,8 @@ namespace
namespace MWGui namespace MWGui
{ {
CharacterCreation::CharacterCreation(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem) CharacterCreation::CharacterCreation(osg::Group* parent, Resource::ResourceSystem* resourceSystem)
: mViewer(viewer) : mParent(parent)
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
, mNameDialog(0) , mNameDialog(0)
, mRaceDialog(0) , mRaceDialog(0)
@ -152,7 +152,7 @@ namespace MWGui
case GM_Race: case GM_Race:
MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog); MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog);
mRaceDialog = 0; mRaceDialog = 0;
mRaceDialog = new RaceDialog(mViewer, mResourceSystem); mRaceDialog = new RaceDialog(mParent, mResourceSystem);
mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen); mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen);
mRaceDialog->setRaceId(mPlayerRaceId); mRaceDialog->setRaceId(mPlayerRaceId);
mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone); mRaceDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onRaceDialogDone);

@ -8,9 +8,9 @@
#include "../mwmechanics/stat.hpp" #include "../mwmechanics/stat.hpp"
namespace osgViewer namespace osg
{ {
class Viewer; class Group;
} }
namespace Resource namespace Resource
@ -39,7 +39,7 @@ namespace MWGui
public: public:
typedef std::vector<int> SkillList; typedef std::vector<int> SkillList;
CharacterCreation(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem); CharacterCreation(osg::Group* parent, Resource::ResourceSystem* resourceSystem);
~CharacterCreation(); ~CharacterCreation();
//Show a dialog //Show a dialog
@ -51,7 +51,7 @@ namespace MWGui
void configureSkills (const SkillList& major, const SkillList& minor); void configureSkills (const SkillList& major, const SkillList& minor);
private: private:
osgViewer::Viewer* mViewer; osg::Group* mParent;
Resource::ResourceSystem* mResourceSystem; Resource::ResourceSystem* mResourceSystem;
//Dialogs //Dialogs

@ -56,7 +56,7 @@ namespace
namespace MWGui namespace MWGui
{ {
InventoryWindow::InventoryWindow(DragAndDrop* dragAndDrop, osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem) InventoryWindow::InventoryWindow(DragAndDrop* dragAndDrop, osg::Group* parent, Resource::ResourceSystem* resourceSystem)
: WindowPinnableBase("openmw_inventory_window.layout") : WindowPinnableBase("openmw_inventory_window.layout")
, mDragAndDrop(dragAndDrop) , mDragAndDrop(dragAndDrop)
, mSelectedItem(-1) , mSelectedItem(-1)
@ -65,7 +65,7 @@ namespace MWGui
, mGuiMode(GM_Inventory) , mGuiMode(GM_Inventory)
, mLastXSize(0) , mLastXSize(0)
, mLastYSize(0) , mLastYSize(0)
, mPreview(new MWRender::InventoryPreview(viewer, resourceSystem, MWMechanics::getPlayer())) , mPreview(new MWRender::InventoryPreview(parent, resourceSystem, MWMechanics::getPlayer()))
, mTrading(false) , mTrading(false)
{ {
mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture())); mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture()));

@ -6,9 +6,9 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
namespace osgViewer namespace osg
{ {
class Viewer; class Group;
} }
namespace Resource namespace Resource
@ -37,7 +37,7 @@ namespace MWGui
class InventoryWindow : public WindowPinnableBase class InventoryWindow : public WindowPinnableBase
{ {
public: public:
InventoryWindow(DragAndDrop* dragAndDrop, osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem); InventoryWindow(DragAndDrop* dragAndDrop, osg::Group* parent, Resource::ResourceSystem* resourceSystem);
virtual void open(); virtual void open();

@ -41,9 +41,9 @@ namespace
namespace MWGui namespace MWGui
{ {
RaceDialog::RaceDialog(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem) RaceDialog::RaceDialog(osg::Group* parent, Resource::ResourceSystem* resourceSystem)
: WindowModal("openmw_chargen_race.layout") : WindowModal("openmw_chargen_race.layout")
, mViewer(viewer) , mParent(parent)
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
, mGenderIndex(0) , mGenderIndex(0)
, mFaceIndex(0) , mFaceIndex(0)
@ -136,7 +136,7 @@ namespace MWGui
mPreview.reset(NULL); mPreview.reset(NULL);
mPreviewTexture.reset(NULL); mPreviewTexture.reset(NULL);
mPreview.reset(new MWRender::RaceSelectionPreview(mViewer, mResourceSystem)); mPreview.reset(new MWRender::RaceSelectionPreview(mParent, mResourceSystem));
mPreview->rebuild(); mPreview->rebuild();
mPreview->setAngle (mCurrentAngle); mPreview->setAngle (mCurrentAngle);

@ -19,9 +19,9 @@ namespace ESM
struct NPC; struct NPC;
} }
namespace osgViewer namespace osg
{ {
class Viewer; class Group;
} }
namespace Resource namespace Resource
@ -34,7 +34,7 @@ namespace MWGui
class RaceDialog : public WindowModal class RaceDialog : public WindowModal
{ {
public: public:
RaceDialog(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem); RaceDialog(osg::Group* parent, Resource::ResourceSystem* resourceSystem);
enum Gender enum Gender
{ {
@ -93,7 +93,7 @@ namespace MWGui
void getBodyParts (int part, std::vector<std::string>& out); void getBodyParts (int part, std::vector<std::string>& out);
osgViewer::Viewer* mViewer; osg::Group* mParent;
Resource::ResourceSystem* mResourceSystem; Resource::ResourceSystem* mResourceSystem;
std::vector<std::string> mAvailableHeads; std::vector<std::string> mAvailableHeads;

@ -293,7 +293,7 @@ namespace MWGui
bool questList = mResourceSystem->getVFS()->exists("textures/tx_menubook_options_over.dds"); bool questList = mResourceSystem->getVFS()->exists("textures/tx_menubook_options_over.dds");
mJournal = JournalWindow::create(JournalViewModel::create (), questList); mJournal = JournalWindow::create(JournalViewModel::create (), questList);
mMessageBoxManager = new MessageBoxManager(mStore->get<ESM::GameSetting>().find("fMessageTimePerChar")->getFloat()); mMessageBoxManager = new MessageBoxManager(mStore->get<ESM::GameSetting>().find("fMessageTimePerChar")->getFloat());
mInventoryWindow = new InventoryWindow(mDragAndDrop, mViewer, mResourceSystem); mInventoryWindow = new InventoryWindow(mDragAndDrop, mViewer->getSceneData()->asGroup(), mResourceSystem);
mTradeWindow = new TradeWindow(); mTradeWindow = new TradeWindow();
trackWindow(mTradeWindow, "barter"); trackWindow(mTradeWindow, "barter");
mSpellBuyingWindow = new SpellBuyingWindow(); mSpellBuyingWindow = new SpellBuyingWindow();
@ -350,7 +350,7 @@ namespace MWGui
mHud->setVisible(mHudEnabled); mHud->setVisible(mHudEnabled);
mCharGen = new CharacterCreation(mViewer, mResourceSystem); mCharGen = new CharacterCreation(mViewer->getSceneData()->asGroup(), mResourceSystem);
// Setup player stats // Setup player stats
for (int i = 0; i < ESM::Attribute::Length; ++i) for (int i = 0; i < ESM::Attribute::Length; ++i)
@ -384,7 +384,7 @@ namespace MWGui
{ {
disallowAll(); disallowAll();
delete mCharGen; delete mCharGen;
mCharGen = new CharacterCreation(mViewer, mResourceSystem); mCharGen = new CharacterCreation(mViewer->getSceneData()->asGroup(), mResourceSystem);
mGuiModes.clear(); mGuiModes.clear();
MWBase::Environment::get().getInputManager()->changeInputMode(false); MWBase::Environment::get().getInputManager()->changeInputMode(false);
mHud->unsetSelectedWeapon(); mHud->unsetSelectedWeapon();

@ -6,8 +6,8 @@
#include <osg/Texture2D> #include <osg/Texture2D>
#include <osg/Camera> #include <osg/Camera>
#include <osg/PositionAttitudeTransform> #include <osg/PositionAttitudeTransform>
#include <osgViewer/Viewer>
#include <osg/LightModel> #include <osg/LightModel>
#include <osg/LightSource>
#include <osgUtil/IntersectionVisitor> #include <osgUtil/IntersectionVisitor>
#include <osgUtil/LineSegmentIntersector> #include <osgUtil/LineSegmentIntersector>
@ -65,9 +65,9 @@ namespace MWRender
unsigned int mLastRenderedFrame; unsigned int mLastRenderedFrame;
}; };
CharacterPreview::CharacterPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem, CharacterPreview::CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem,
MWWorld::Ptr character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt) MWWorld::Ptr character, int sizeX, int sizeY, const osg::Vec3f& position, const osg::Vec3f& lookAt)
: mViewer(viewer) : mParent(parent)
, mResourceSystem(resourceSystem) , mResourceSystem(resourceSystem)
, mPosition(position) , mPosition(position)
, mLookAt(lookAt) , mLookAt(lookAt)
@ -139,7 +139,7 @@ namespace MWRender
mDrawOnceCallback = new DrawOnceCallback; mDrawOnceCallback = new DrawOnceCallback;
mCamera->addUpdateCallback(mDrawOnceCallback); mCamera->addUpdateCallback(mDrawOnceCallback);
mViewer->getSceneData()->asGroup()->addChild(mCamera); mParent->addChild(mCamera);
mCharacter.mCell = NULL; mCharacter.mCell = NULL;
} }
@ -147,7 +147,7 @@ namespace MWRender
CharacterPreview::~CharacterPreview () CharacterPreview::~CharacterPreview ()
{ {
mCamera->removeChildren(0, mCamera->getNumChildren()); mCamera->removeChildren(0, mCamera->getNumChildren());
mViewer->getSceneData()->asGroup()->removeChild(mCamera); mParent->removeChild(mCamera);
} }
int CharacterPreview::getTextureWidth() const int CharacterPreview::getTextureWidth() const
@ -190,8 +190,8 @@ namespace MWRender
// -------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------
InventoryPreview::InventoryPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character) InventoryPreview::InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character)
: CharacterPreview(viewer, resourceSystem, character, 512, 1024, osg::Vec3f(0, 700, 71), osg::Vec3f(0,0,71)) : CharacterPreview(parent, resourceSystem, character, 512, 1024, osg::Vec3f(0, 700, 71), osg::Vec3f(0,0,71))
{ {
} }
@ -319,8 +319,8 @@ namespace MWRender
// -------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------
RaceSelectionPreview::RaceSelectionPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem) RaceSelectionPreview::RaceSelectionPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem)
: CharacterPreview(viewer, resourceSystem, MWMechanics::getPlayer(), : CharacterPreview(parent, resourceSystem, MWMechanics::getPlayer(),
512, 512, osg::Vec3f(0, 125, 8), osg::Vec3f(0,0,8)) 512, 512, osg::Vec3f(0, 125, 8), osg::Vec3f(0,0,8))
, mBase (*mCharacter.get<ESM::NPC>()->mBase) , mBase (*mCharacter.get<ESM::NPC>()->mBase)
, mRef(&mBase) , mRef(&mBase)

@ -16,11 +16,7 @@ namespace osg
{ {
class Texture2D; class Texture2D;
class Camera; class Camera;
} class Group;
namespace osgViewer
{
class Viewer;
} }
namespace MWRender namespace MWRender
@ -32,7 +28,7 @@ namespace MWRender
class CharacterPreview class CharacterPreview
{ {
public: public:
CharacterPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character, int sizeX, int sizeY, CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character, int sizeX, int sizeY,
const osg::Vec3f& position, const osg::Vec3f& lookAt); const osg::Vec3f& position, const osg::Vec3f& lookAt);
virtual ~CharacterPreview(); virtual ~CharacterPreview();
@ -53,7 +49,7 @@ namespace MWRender
virtual bool renderHeadOnly() { return false; } virtual bool renderHeadOnly() { return false; }
virtual void onSetup(); virtual void onSetup();
osg::ref_ptr<osgViewer::Viewer> mViewer; osg::ref_ptr<osg::Group> mParent;
Resource::ResourceSystem* mResourceSystem; Resource::ResourceSystem* mResourceSystem;
osg::ref_ptr<osg::Texture2D> mTexture; osg::ref_ptr<osg::Texture2D> mTexture;
osg::ref_ptr<osg::Camera> mCamera; osg::ref_ptr<osg::Camera> mCamera;
@ -76,7 +72,7 @@ namespace MWRender
{ {
public: public:
InventoryPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character); InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character);
void updatePtr(const MWWorld::Ptr& ptr); void updatePtr(const MWWorld::Ptr& ptr);
@ -102,7 +98,7 @@ namespace MWRender
virtual void onSetup(); virtual void onSetup();
public: public:
RaceSelectionPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem); RaceSelectionPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem);
virtual ~RaceSelectionPreview(); virtual ~RaceSelectionPreview();
void setAngle(float angleRadians); void setAngle(float angleRadians);

@ -10,11 +10,6 @@
#include "resourcemanager.hpp" #include "resourcemanager.hpp"
namespace osgViewer
{
class Viewer;
}
namespace osgDB namespace osgDB
{ {
class Options; class Options;

Loading…
Cancel
Save