forked from mirror/openmw-tes3mp
added navigation mode selection
This commit is contained in:
parent
526d75df51
commit
8f73cc9268
4 changed files with 48 additions and 14 deletions
|
@ -15,7 +15,7 @@ namespace CSVRender
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, mWindow(NULL)
|
, mWindow(NULL)
|
||||||
, mCamera(NULL)
|
, mCamera(NULL)
|
||||||
, mSceneMgr(NULL), mNavigationMode (NavigationMode_Free), mUpdate (false)
|
, mSceneMgr(NULL), mNavigationMode (NavigationMode_1stPerson), mUpdate (false)
|
||||||
, mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false)
|
, mKeyForward (false), mKeyBackward (false), mKeyLeft (false), mKeyRight (false)
|
||||||
, mFast (false), mDragging (false), mMod1 (false)
|
, mFast (false), mDragging (false), mMod1 (false)
|
||||||
, mMouseSensitivity (2), mFastFactor (4) /// \todo make these configurable
|
, mMouseSensitivity (2), mFastFactor (4) /// \todo make these configurable
|
||||||
|
@ -94,6 +94,15 @@ namespace CSVRender
|
||||||
Ogre::Root::getSingleton().destroyRenderTarget(mWindow);
|
Ogre::Root::getSingleton().destroyRenderTarget(mWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneWidget::setNavigationMode (NavigationMode mode)
|
||||||
|
{
|
||||||
|
if (mode!=mNavigationMode)
|
||||||
|
{
|
||||||
|
mNavigationMode = mode;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SceneWidget::paintEvent(QPaintEvent* e)
|
void SceneWidget::paintEvent(QPaintEvent* e)
|
||||||
{
|
{
|
||||||
if (!mWindow)
|
if (!mWindow)
|
||||||
|
|
|
@ -20,14 +20,18 @@ namespace CSVRender
|
||||||
|
|
||||||
enum NavigationMode
|
enum NavigationMode
|
||||||
{
|
{
|
||||||
NavigationMode_Free
|
NavigationMode_1stPerson,
|
||||||
|
NavigationMode_Free,
|
||||||
|
NavigationMode_Orbit
|
||||||
};
|
};
|
||||||
|
|
||||||
SceneWidget(QWidget *parent);
|
SceneWidget(QWidget *parent);
|
||||||
virtual ~SceneWidget(void);
|
virtual ~SceneWidget();
|
||||||
|
|
||||||
QPaintEngine* paintEngine() const;
|
QPaintEngine* paintEngine() const;
|
||||||
|
|
||||||
|
void setNavigationMode (NavigationMode mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void paintEvent(QPaintEvent* e);
|
void paintEvent(QPaintEvent* e);
|
||||||
void resizeEvent(QResizeEvent* e);
|
void resizeEvent(QResizeEvent* e);
|
||||||
|
|
|
@ -32,20 +32,21 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
layout2->setContentsMargins (QMargins (0, 0, 0, 0));
|
layout2->setContentsMargins (QMargins (0, 0, 0, 0));
|
||||||
|
|
||||||
SceneToolbar *toolbar = new SceneToolbar (48, this);
|
SceneToolbar *toolbar = new SceneToolbar (48, this);
|
||||||
// test
|
|
||||||
SceneToolMode *tool = new SceneToolMode (toolbar);
|
// navigation mode
|
||||||
tool->addButton (":door.png", "a");
|
SceneToolMode *tool = new SceneToolMode (toolbar);
|
||||||
tool->addButton (":GMST.png", "b");
|
tool->addButton (":door.png", "1st"); /// \todo replace icons
|
||||||
tool->addButton (":Info.png", "c");
|
tool->addButton (":GMST.png", "free");
|
||||||
toolbar->addTool (tool);
|
tool->addButton (":Info.png", "orbit");
|
||||||
toolbar->addTool (new SceneToolMode (toolbar));
|
toolbar->addTool (tool);
|
||||||
toolbar->addTool (new SceneToolMode (toolbar));
|
connect (tool, SIGNAL (modeChanged (const std::string&)),
|
||||||
toolbar->addTool (new SceneToolMode (toolbar));
|
this, SLOT (selectNavigationMode (const std::string&)));
|
||||||
|
|
||||||
layout2->addWidget (toolbar, 0);
|
layout2->addWidget (toolbar, 0);
|
||||||
|
|
||||||
CSVRender::SceneWidget* sceneWidget = new CSVRender::SceneWidget(this);
|
mScene = new CSVRender::SceneWidget(this);
|
||||||
|
|
||||||
layout2->addWidget (sceneWidget, 1);
|
layout2->addWidget (mScene, 1);
|
||||||
|
|
||||||
layout->insertLayout (0, layout2, 1);
|
layout->insertLayout (0, layout2, 1);
|
||||||
|
|
||||||
|
@ -76,3 +77,13 @@ void CSVWorld::SceneSubView::setStatusBar (bool show)
|
||||||
{
|
{
|
||||||
mBottom->setStatusBar (show);
|
mBottom->setStatusBar (show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::SceneSubView::selectNavigationMode (const std::string& mode)
|
||||||
|
{
|
||||||
|
if (mode=="1st")
|
||||||
|
mScene->setNavigationMode (CSVRender::SceneWidget::NavigationMode_1stPerson);
|
||||||
|
else if (mode=="free")
|
||||||
|
mScene->setNavigationMode (CSVRender::SceneWidget::NavigationMode_Free);
|
||||||
|
else if (mode=="orbit")
|
||||||
|
mScene->setNavigationMode (CSVRender::SceneWidget::NavigationMode_Orbit);
|
||||||
|
}
|
||||||
|
|
|
@ -10,6 +10,11 @@ namespace CSMDoc
|
||||||
class Document;
|
class Document;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace CSVRender
|
||||||
|
{
|
||||||
|
class SceneWidget;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
{
|
{
|
||||||
class Table;
|
class Table;
|
||||||
|
@ -21,6 +26,7 @@ namespace CSVWorld
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
TableBottomBox *mBottom;
|
TableBottomBox *mBottom;
|
||||||
|
CSVRender::SceneWidget *mScene;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -31,6 +37,10 @@ namespace CSVWorld
|
||||||
virtual void updateEditorSetting (const QString& key, const QString& value);
|
virtual void updateEditorSetting (const QString& key, const QString& value);
|
||||||
|
|
||||||
virtual void setStatusBar (bool show);
|
virtual void setStatusBar (bool show);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void selectNavigationMode (const std::string& mode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue