forked from teamnwah/openmw-tes3coop
Remove leftovers of the old OpenCS navigation
This commit is contained in:
parent
dd23981eab
commit
1ba3fa4169
15 changed files with 1 additions and 456 deletions
|
@ -82,7 +82,7 @@ opencs_units (view/render
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_units_noqt (view/render
|
opencs_units_noqt (view/render
|
||||||
navigation navigation1st navigationfree navigationorbit lighting lightingday lightingnight
|
lighting lightingday lightingnight
|
||||||
lightingbright object cell terrainstorage
|
lightingbright object cell terrainstorage
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
|
|
||||||
#include "lighting.hpp"
|
#include "lighting.hpp"
|
||||||
|
|
||||||
namespace Ogre
|
|
||||||
{
|
|
||||||
class Light;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
class LightingDay : public Lighting
|
class LightingDay : public Lighting
|
||||||
|
|
|
@ -3,11 +3,6 @@
|
||||||
|
|
||||||
#include "lighting.hpp"
|
#include "lighting.hpp"
|
||||||
|
|
||||||
namespace Ogre
|
|
||||||
{
|
|
||||||
class Light;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
class LightingNight : public Lighting
|
class LightingNight : public Lighting
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
|
|
||||||
#include "navigation.hpp"
|
|
||||||
|
|
||||||
float CSVRender::Navigation::getFactor (bool mouse) const
|
|
||||||
{
|
|
||||||
float factor = mFastModeFactor;
|
|
||||||
|
|
||||||
if (mouse)
|
|
||||||
factor /= 2; /// \todo make this configurable
|
|
||||||
|
|
||||||
return factor;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSVRender::Navigation::Navigation()
|
|
||||||
: mFastModeFactor(1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CSVRender::Navigation::~Navigation() {}
|
|
||||||
|
|
||||||
void CSVRender::Navigation::setFastModeFactor (float factor)
|
|
||||||
{
|
|
||||||
mFastModeFactor = factor;
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
#ifndef OPENCS_VIEW_NAVIGATION_H
|
|
||||||
#define OPENCS_VIEW_NAVIGATION_H
|
|
||||||
|
|
||||||
class QPoint;
|
|
||||||
|
|
||||||
namespace Ogre
|
|
||||||
{
|
|
||||||
class Camera;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CSVRender
|
|
||||||
{
|
|
||||||
class Navigation
|
|
||||||
{
|
|
||||||
float mFastModeFactor;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
float getFactor (bool mouse) const;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Navigation();
|
|
||||||
virtual ~Navigation();
|
|
||||||
|
|
||||||
void setFastModeFactor (float factor);
|
|
||||||
///< Set currently applying fast mode factor.
|
|
||||||
|
|
||||||
virtual bool activate (Ogre::Camera *camera) = 0;
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool wheelMoved (int delta) = 0;
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool mouseMoved (const QPoint& delta, int mode) = 0;
|
|
||||||
///< \param mode: 0: default mouse key, 1: default mouse key and modifier key 1
|
|
||||||
/// \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleMovementKeys (int vertical, int horizontal) = 0;
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleRollKeys (int delta) = 0;
|
|
||||||
///< \return Update required?
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,86 +0,0 @@
|
||||||
|
|
||||||
#include "navigation1st.hpp"
|
|
||||||
|
|
||||||
#include <OgreCamera.h>
|
|
||||||
|
|
||||||
#include <QPoint>
|
|
||||||
|
|
||||||
CSVRender::Navigation1st::Navigation1st() : mCamera (0) {}
|
|
||||||
|
|
||||||
bool CSVRender::Navigation1st::activate (Ogre::Camera *camera)
|
|
||||||
{
|
|
||||||
mCamera = camera;
|
|
||||||
mCamera->setFixedYawAxis (true, Ogre::Vector3::UNIT_Z);
|
|
||||||
|
|
||||||
Ogre::Radian pitch = mCamera->getOrientation().getPitch();
|
|
||||||
|
|
||||||
Ogre::Radian limit (Ogre::Math::PI/2-0.5);
|
|
||||||
|
|
||||||
if (pitch>limit)
|
|
||||||
mCamera->pitch (-(pitch-limit));
|
|
||||||
else if (pitch<-limit)
|
|
||||||
mCamera->pitch (pitch-limit);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::Navigation1st::wheelMoved (int delta)
|
|
||||||
{
|
|
||||||
mCamera->move (getFactor (true) * mCamera->getDirection() * delta);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::Navigation1st::mouseMoved (const QPoint& delta, int mode)
|
|
||||||
{
|
|
||||||
if (mode==0)
|
|
||||||
{
|
|
||||||
// turn camera
|
|
||||||
if (delta.x())
|
|
||||||
mCamera->yaw (Ogre::Degree (getFactor (true) * delta.x()));
|
|
||||||
|
|
||||||
if (delta.y())
|
|
||||||
{
|
|
||||||
Ogre::Radian oldPitch = mCamera->getOrientation().getPitch();
|
|
||||||
float deltaPitch = getFactor (true) * delta.y();
|
|
||||||
Ogre::Radian newPitch = oldPitch + Ogre::Degree (deltaPitch);
|
|
||||||
|
|
||||||
if ((deltaPitch>0 && newPitch<Ogre::Radian(Ogre::Math::PI-0.5)) ||
|
|
||||||
(deltaPitch<0 && newPitch>Ogre::Radian(0.5)))
|
|
||||||
{
|
|
||||||
mCamera->pitch (Ogre::Degree (deltaPitch));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (mode==1)
|
|
||||||
{
|
|
||||||
// pan camera
|
|
||||||
if (delta.x())
|
|
||||||
mCamera->move (getFactor (true) * mCamera->getDerivedRight() * delta.x());
|
|
||||||
|
|
||||||
if (delta.y())
|
|
||||||
mCamera->move (getFactor (true) * -mCamera->getDerivedUp() * delta.y());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::Navigation1st::handleMovementKeys (int vertical, int horizontal)
|
|
||||||
{
|
|
||||||
if (vertical)
|
|
||||||
mCamera->move (getFactor (false) * mCamera->getDirection() * vertical);
|
|
||||||
|
|
||||||
if (horizontal)
|
|
||||||
mCamera->move (getFactor (true) * mCamera->getDerivedRight() * horizontal);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::Navigation1st::handleRollKeys (int delta)
|
|
||||||
{
|
|
||||||
// we don't roll this way in 1st person mode
|
|
||||||
return false;
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
#ifndef OPENCS_VIEW_NAVIGATION1ST_H
|
|
||||||
#define OPENCS_VIEW_NAVIGATION1ST_H
|
|
||||||
|
|
||||||
#include "navigation.hpp"
|
|
||||||
|
|
||||||
namespace CSVRender
|
|
||||||
{
|
|
||||||
/// \brief First person-like camera controls
|
|
||||||
class Navigation1st : public Navigation
|
|
||||||
{
|
|
||||||
Ogre::Camera *mCamera;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Navigation1st();
|
|
||||||
|
|
||||||
virtual bool activate (Ogre::Camera *camera);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool wheelMoved (int delta);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool mouseMoved (const QPoint& delta, int mode);
|
|
||||||
///< \param mode: 0: default mouse key, 1: default mouse key and modifier key 1
|
|
||||||
/// \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleMovementKeys (int vertical, int horizontal);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleRollKeys (int delta);
|
|
||||||
///< \return Update required?
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,66 +0,0 @@
|
||||||
|
|
||||||
#include "navigationfree.hpp"
|
|
||||||
|
|
||||||
#include <OgreCamera.h>
|
|
||||||
|
|
||||||
#include <QPoint>
|
|
||||||
|
|
||||||
CSVRender::NavigationFree::NavigationFree() : mCamera (0) {}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationFree::activate (Ogre::Camera *camera)
|
|
||||||
{
|
|
||||||
mCamera = camera;
|
|
||||||
mCamera->setFixedYawAxis (false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationFree::wheelMoved (int delta)
|
|
||||||
{
|
|
||||||
mCamera->move (getFactor (true) * mCamera->getDirection() * delta);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationFree::mouseMoved (const QPoint& delta, int mode)
|
|
||||||
{
|
|
||||||
if (mode==0)
|
|
||||||
{
|
|
||||||
// turn camera
|
|
||||||
if (delta.x())
|
|
||||||
mCamera->yaw (Ogre::Degree (getFactor (true) * delta.x()));
|
|
||||||
|
|
||||||
if (delta.y())
|
|
||||||
mCamera->pitch (Ogre::Degree (getFactor (true) * delta.y()));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (mode==1)
|
|
||||||
{
|
|
||||||
// pan camera
|
|
||||||
if (delta.x())
|
|
||||||
mCamera->move (getFactor (true) * mCamera->getDerivedRight() * delta.x());
|
|
||||||
|
|
||||||
if (delta.y())
|
|
||||||
mCamera->move (getFactor (true) * -mCamera->getDerivedUp() * delta.y());
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationFree::handleMovementKeys (int vertical, int horizontal)
|
|
||||||
{
|
|
||||||
if (vertical)
|
|
||||||
mCamera->move (getFactor (false) * mCamera->getDerivedUp() * vertical);
|
|
||||||
|
|
||||||
if (horizontal)
|
|
||||||
mCamera->move (getFactor (true) * mCamera->getDerivedRight() * horizontal);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationFree::handleRollKeys (int delta)
|
|
||||||
{
|
|
||||||
mCamera->roll (Ogre::Degree (getFactor (false) * delta));
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
#ifndef OPENCS_VIEW_NAVIGATIONFREE_H
|
|
||||||
#define OPENCS_VIEW_NAVIGATIONFREE_H
|
|
||||||
|
|
||||||
#include "navigation.hpp"
|
|
||||||
|
|
||||||
namespace CSVRender
|
|
||||||
{
|
|
||||||
/// \brief Free camera controls
|
|
||||||
class NavigationFree : public Navigation
|
|
||||||
{
|
|
||||||
Ogre::Camera *mCamera;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
NavigationFree();
|
|
||||||
|
|
||||||
virtual bool activate (Ogre::Camera *camera);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool wheelMoved (int delta);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool mouseMoved (const QPoint& delta, int mode);
|
|
||||||
///< \param mode: 0: default mouse key, 1: default mouse key and modifier key 1
|
|
||||||
/// \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleMovementKeys (int vertical, int horizontal);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleRollKeys (int delta);
|
|
||||||
///< \return Update required?
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,100 +0,0 @@
|
||||||
|
|
||||||
#include "navigationorbit.hpp"
|
|
||||||
|
|
||||||
#include <OgreCamera.h>
|
|
||||||
|
|
||||||
#include <QPoint>
|
|
||||||
|
|
||||||
void CSVRender::NavigationOrbit::rotateCamera (const Ogre::Vector3& diff)
|
|
||||||
{
|
|
||||||
Ogre::Vector3 pos = mCamera->getPosition();
|
|
||||||
|
|
||||||
float distance = (pos-mCentre).length();
|
|
||||||
|
|
||||||
Ogre::Vector3 direction = (pos+diff)-mCentre;
|
|
||||||
direction.normalise();
|
|
||||||
|
|
||||||
mCamera->setPosition (mCentre + direction*distance);
|
|
||||||
mCamera->lookAt (mCentre);
|
|
||||||
}
|
|
||||||
|
|
||||||
CSVRender::NavigationOrbit::NavigationOrbit() : mCamera (0), mCentre (0, 0, 0), mDistance (100)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationOrbit::activate (Ogre::Camera *camera)
|
|
||||||
{
|
|
||||||
mCamera = camera;
|
|
||||||
mCamera->setFixedYawAxis (false);
|
|
||||||
|
|
||||||
if ((mCamera->getPosition()-mCentre).length()<mDistance)
|
|
||||||
{
|
|
||||||
// move camera out of the centre area
|
|
||||||
Ogre::Vector3 direction = mCentre-mCamera->getPosition();
|
|
||||||
direction.normalise();
|
|
||||||
|
|
||||||
if (direction.length()==0)
|
|
||||||
direction = Ogre::Vector3 (1, 0, 0);
|
|
||||||
|
|
||||||
mCamera->setPosition (mCentre - direction * mDistance);
|
|
||||||
}
|
|
||||||
|
|
||||||
mCamera->lookAt (mCentre);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationOrbit::wheelMoved (int delta)
|
|
||||||
{
|
|
||||||
Ogre::Vector3 diff = getFactor (true) * mCamera->getDirection() * delta;
|
|
||||||
|
|
||||||
Ogre::Vector3 pos = mCamera->getPosition();
|
|
||||||
|
|
||||||
if (delta>0 && diff.length()>=(pos-mCentre).length()-mDistance)
|
|
||||||
{
|
|
||||||
pos = mCentre-(mCamera->getDirection() * mDistance);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pos += diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
mCamera->setPosition (pos);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationOrbit::mouseMoved (const QPoint& delta, int mode)
|
|
||||||
{
|
|
||||||
Ogre::Vector3 diff =
|
|
||||||
getFactor (true) * -mCamera->getDerivedRight() * delta.x()
|
|
||||||
+ getFactor (true) * mCamera->getDerivedUp() * delta.y();
|
|
||||||
|
|
||||||
if (mode==0)
|
|
||||||
{
|
|
||||||
rotateCamera (diff);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (mode==1)
|
|
||||||
{
|
|
||||||
mCamera->move (diff);
|
|
||||||
mCentre += diff;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationOrbit::handleMovementKeys (int vertical, int horizontal)
|
|
||||||
{
|
|
||||||
rotateCamera (
|
|
||||||
- getFactor (false) * -mCamera->getDerivedRight() * horizontal
|
|
||||||
+ getFactor (false) * mCamera->getDerivedUp() * vertical);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSVRender::NavigationOrbit::handleRollKeys (int delta)
|
|
||||||
{
|
|
||||||
mCamera->roll (Ogre::Degree (getFactor (false) * delta));
|
|
||||||
return true;
|
|
||||||
}
|
|
|
@ -1,42 +0,0 @@
|
||||||
#ifndef OPENCS_VIEW_NAVIGATIONORBIT_H
|
|
||||||
#define OPENCS_VIEW_NAVIGATIONORBIT_H
|
|
||||||
|
|
||||||
#include "navigation.hpp"
|
|
||||||
|
|
||||||
#include <OgreVector3.h>
|
|
||||||
|
|
||||||
namespace CSVRender
|
|
||||||
{
|
|
||||||
/// \brief Orbiting camera controls
|
|
||||||
class NavigationOrbit : public Navigation
|
|
||||||
{
|
|
||||||
Ogre::Camera *mCamera;
|
|
||||||
Ogre::Vector3 mCentre;
|
|
||||||
int mDistance;
|
|
||||||
|
|
||||||
void rotateCamera (const Ogre::Vector3& diff);
|
|
||||||
///< Rotate camera around centre.
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
NavigationOrbit();
|
|
||||||
|
|
||||||
virtual bool activate (Ogre::Camera *camera);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool wheelMoved (int delta);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool mouseMoved (const QPoint& delta, int mode);
|
|
||||||
///< \param mode: 0: default mouse key, 1: default mouse key and modifier key 1
|
|
||||||
/// \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleMovementKeys (int vertical, int horizontal);
|
|
||||||
///< \return Update required?
|
|
||||||
|
|
||||||
virtual bool handleRollKeys (int delta);
|
|
||||||
///< \return Update required?
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "scenewidget.hpp"
|
#include "scenewidget.hpp"
|
||||||
|
|
||||||
#include "navigationorbit.hpp"
|
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
@ -25,7 +24,6 @@ namespace CSVRender
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
CSMWorld::Data& mData;
|
CSMWorld::Data& mData;
|
||||||
CSVRender::NavigationOrbit mOrbit;
|
|
||||||
CSVRender::Object mObject;
|
CSVRender::Object mObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "../widget/scenetoolmode.hpp"
|
#include "../widget/scenetoolmode.hpp"
|
||||||
#include "../../model/settings/usersettings.hpp"
|
#include "../../model/settings/usersettings.hpp"
|
||||||
|
|
||||||
#include "navigation.hpp"
|
|
||||||
#include "lighting.hpp"
|
#include "lighting.hpp"
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
|
|
|
@ -29,7 +29,6 @@ namespace CSVWidget
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
class Navigation;
|
|
||||||
class Lighting;
|
class Lighting;
|
||||||
|
|
||||||
class RenderWidget : public QWidget
|
class RenderWidget : public QWidget
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
|
|
||||||
#include "scenewidget.hpp"
|
#include "scenewidget.hpp"
|
||||||
|
|
||||||
#include "navigation1st.hpp"
|
|
||||||
#include "navigationfree.hpp"
|
|
||||||
#include "navigationorbit.hpp"
|
|
||||||
#include <apps/opencs/model/doc/document.hpp>
|
#include <apps/opencs/model/doc/document.hpp>
|
||||||
#include <apps/opencs/model/world/tablemimedata.hpp>
|
#include <apps/opencs/model/world/tablemimedata.hpp>
|
||||||
|
|
||||||
|
@ -30,9 +27,6 @@ namespace CSVRender
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
CSVRender::Navigation1st m1st;
|
|
||||||
CSVRender::NavigationFree mFree;
|
|
||||||
CSVRender::NavigationOrbit mOrbit;
|
|
||||||
CSVWidget::SceneToolToggle2 *mSceneElements;
|
CSVWidget::SceneToolToggle2 *mSceneElements;
|
||||||
CSVWidget::SceneToolRun *mRun;
|
CSVWidget::SceneToolRun *mRun;
|
||||||
CSMDoc::Document& mDocument;
|
CSMDoc::Document& mDocument;
|
||||||
|
|
Loading…
Reference in a new issue