OpenCS: connect navigation button to OSG camera manipulators

c++11
scrawl 10 years ago
parent 1edccdbe55
commit e3bfbcb44b

@ -171,19 +171,15 @@ void CSVRender::PagedWorldspaceWidget::referenceAdded (const QModelIndex& parent
std::string CSVRender::PagedWorldspaceWidget::getStartupInstruction()
{
/*
Ogre::Vector3 position = getCamera()->getPosition();
osg::Vec3d position = mView->getCamera()->getViewMatrix().getTrans();
std::ostringstream stream;
stream
<< "player->position "
<< position.x << ", " << position.y << ", " << position.z
<< position.x() << ", " << position.y() << ", " << position.z()
<< ", 0";
return stream.str();
*/
return "";
}
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document)

@ -6,12 +6,10 @@
#include "../../model/world/data.hpp"
#include "../../model/world/idtable.hpp"
CSVRender::PreviewWidget::PreviewWidget (const VFS::Manager* vfs, CSMWorld::Data& data,
CSVRender::PreviewWidget::PreviewWidget (CSMWorld::Data& data,
const std::string& id, bool referenceable, QWidget *parent)
: SceneWidget (parent), mData (data), mObject(data, mRootNode, id, referenceable)
{
//setNavigation (&mOrbit);
mView->setCameraManipulator(new osgGA::TrackballManipulator);
QAbstractItemModel *referenceables =

@ -30,7 +30,7 @@ namespace CSVRender
public:
PreviewWidget (const VFS::Manager* vfs, CSMWorld::Data& data, const std::string& id, bool referenceable,
PreviewWidget (CSMWorld::Data& data, const std::string& id, bool referenceable,
QWidget *parent = 0);
signals:

@ -166,19 +166,16 @@ void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()
{
/*
Ogre::Vector3 position = getCamera()->getPosition();
osg::Vec3d position = mView->getCamera()->getViewMatrix().getTrans();
std::ostringstream stream;
stream
<< "player->positionCell "
<< position.x << ", " << position.y << ", " << position.z
<< position.x() << ", " << position.y() << ", " << position.z()
<< ", 0, \"" << mCellId << "\"";
return stream.str();
*/
return "";
}
CSVRender::WorldspaceWidget::dropRequirments CSVRender::UnpagedWorldspaceWidget::getDropRequirements (CSVRender::WorldspaceWidget::DropType type) const

@ -5,6 +5,9 @@
#include <QtGui/qevent.h>
#include <osgGA/TrackballManipulator>
#include <osgGA/FirstPersonManipulator>
#include "../../model/world/universalid.hpp"
#include "../../model/world/idtable.hpp"
@ -16,7 +19,7 @@
#include "editmode.hpp"
CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent)
: SceneWidget (parent), mDocument(document), mSceneElements(0), mRun(0), mMouse(0),
: SceneWidget (parent), mDocument(document), mSceneElements(0), mRun(0),
mInteractionMask (0)
{
setAcceptDrops(true);
@ -48,32 +51,27 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg
this, SLOT (debugProfileDataChanged (const QModelIndex&, const QModelIndex&)));
connect (debugProfiles, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)),
this, SLOT (debugProfileAboutToBeRemoved (const QModelIndex&, int, int)));
//mMouse = new MouseState(this);
}
CSVRender::WorldspaceWidget::~WorldspaceWidget ()
{
//delete mMouse;
}
void CSVRender::WorldspaceWidget::selectNavigationMode (const std::string& mode)
{
/*
if (mode=="1st")
setNavigation (&m1st);
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
else if (mode=="free")
setNavigation (&mFree);
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
else if (mode=="orbit")
setNavigation (&mOrbit);
*/
mView->setCameraManipulator(new osgGA::OrbitManipulator);
}
void CSVRender::WorldspaceWidget::useViewHint (const std::string& hint) {}
void CSVRender::WorldspaceWidget::selectDefaultNavigationMode()
{
//setNavigation (&m1st);
mView->setCameraManipulator(new osgGA::FirstPersonManipulator);
}
CSVWidget::SceneToolMode *CSVRender::WorldspaceWidget::makeNavigationSelector (

@ -26,8 +26,6 @@ namespace CSVWidget
namespace CSVRender
{
class MouseState;
class WorldspaceWidget : public SceneWidget
{
Q_OBJECT
@ -38,7 +36,6 @@ namespace CSVRender
CSVWidget::SceneToolToggle2 *mSceneElements;
CSVWidget::SceneToolRun *mRun;
CSMDoc::Document& mDocument;
MouseState *mMouse;
unsigned int mInteractionMask;
public:

@ -23,10 +23,10 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
referenceableIdChanged (referenceableId);
mScene =
new CSVRender::PreviewWidget (document.getVFS(), document.getData(), id.getId(), false, this);
new CSVRender::PreviewWidget (document.getData(), id.getId(), false, this);
}
else
mScene = new CSVRender::PreviewWidget (document.getVFS(), document.getData(), id.getId(), true, this);
mScene = new CSVRender::PreviewWidget (document.getData(), id.getId(), true, this);
CSVWidget::SceneToolbar *toolbar = new CSVWidget::SceneToolbar (48+6, this);

Loading…
Cancel
Save