CharacterPreview no longer depends on osgViewer

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

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

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

@ -56,7 +56,7 @@ namespace
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")
, mDragAndDrop(dragAndDrop)
, mSelectedItem(-1)
@ -65,7 +65,7 @@ namespace MWGui
, mGuiMode(GM_Inventory)
, mLastXSize(0)
, mLastYSize(0)
, mPreview(new MWRender::InventoryPreview(viewer, resourceSystem, MWMechanics::getPlayer()))
, mPreview(new MWRender::InventoryPreview(parent, resourceSystem, MWMechanics::getPlayer()))
, mTrading(false)
{
mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture()));

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

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

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

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

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

@ -16,11 +16,7 @@ namespace osg
{
class Texture2D;
class Camera;
}
namespace osgViewer
{
class Viewer;
class Group;
}
namespace MWRender
@ -32,7 +28,7 @@ namespace MWRender
class CharacterPreview
{
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);
virtual ~CharacterPreview();
@ -53,7 +49,7 @@ namespace MWRender
virtual bool renderHeadOnly() { return false; }
virtual void onSetup();
osg::ref_ptr<osgViewer::Viewer> mViewer;
osg::ref_ptr<osg::Group> mParent;
Resource::ResourceSystem* mResourceSystem;
osg::ref_ptr<osg::Texture2D> mTexture;
osg::ref_ptr<osg::Camera> mCamera;
@ -76,7 +72,7 @@ namespace MWRender
{
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);
@ -102,7 +98,7 @@ namespace MWRender
virtual void onSetup();
public:
RaceSelectionPreview(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem);
RaceSelectionPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem);
virtual ~RaceSelectionPreview();
void setAngle(float angleRadians);

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

Loading…
Cancel
Save