Add button for camera mouse inversion in user preferences, and separate the

sensitivity settings for orbit and free cameras.
openmw-39
Aesylwinn 9 years ago
parent e127c691e2
commit e07687ee01

@ -172,7 +172,10 @@ void CSMPrefs::State::declare()
inputButtons.add (left).add (cLeft).add (right).add (cRight).add (middle).add (cMiddle);
declareEnum ("p-navi", "Primary Camera Navigation Button", left).addValues (inputButtons);
declareEnum ("s-navi", "Secondary Camera Navigation Button", cLeft).addValues (inputButtons);
declareDouble ("p-navi-sensitivity", "Camera Sensitivity", 1/650.).setPrecision(4).setRange(-2.0, 2.0);
declareDouble ("p-navi-free-sensitivity", "Free Camera Sensitivity", 1/650.).setPrecision(5).setRange(0.0, 1.0);
declareBool ("p-navi-free-invert", "Invert Free Camera Mouse Input", false);
declareDouble ("p-navi-orbit-sensitivity", "Orbit Camera Sensitivity", 1/650.).setPrecision(5).setRange(0.0, 1.0);
declareBool ("p-navi-orbit-invert", "Invert Orbit Camera Mouse Input", false);
declareDouble ("s-navi-sensitivity", "Secondary Camera Movement Sensitivity", 50.0).setRange(-1000.0, 1000.0);
declareDouble ("navi-wheel-factor", "Camera Zoom Sensitivity", 8).setRange(-100.0, 100.0);
declareDouble ("navi-free-lin-speed", "Free Camera Linear Speed", 1000.0).setRange(1.0, 10000.0);

@ -27,6 +27,7 @@ namespace CSVRender
CameraController::CameraController()
: mActive(false)
, mInverted(false)
, mCameraSensitivity(1/650.f)
, mSecondaryMoveMult(50)
, mWheelMoveMult(8)
@ -53,6 +54,11 @@ namespace CSVRender
return mCameraSensitivity;
}
bool CameraController::getInverted() const
{
return mInverted;
}
double CameraController::getSecondaryMovementMultiplier() const
{
return mSecondaryMoveMult;
@ -77,6 +83,11 @@ namespace CSVRender
mCameraSensitivity = value;
}
void CameraController::setInverted(bool value)
{
mInverted = value;
}
void CameraController::setSecondaryMovementMultiplier(double value)
{
mSecondaryMoveMult = value;
@ -234,8 +245,9 @@ namespace CSVRender
if (mode == "p-navi")
{
yaw(x * getCameraSensitivity());
pitch(y * getCameraSensitivity());
double scalar = getCameraSensitivity() * (getInverted() ? -1.0 : 1.0);
yaw(x * scalar);
pitch(y * scalar);
}
else if (mode == "s-navi")
{
@ -448,8 +460,9 @@ namespace CSVRender
if (mode == "p-navi")
{
rotateHorizontal(x * getCameraSensitivity());
rotateVertical(-y * getCameraSensitivity());
double scalar = getCameraSensitivity() * (getInverted() ? -1.0 : 1.0);
rotateHorizontal(x * scalar);
rotateVertical(-y * scalar);
}
else if (mode == "s-navi")
{

@ -33,11 +33,13 @@ namespace CSVRender
osg::Camera* getCamera() const;
double getCameraSensitivity() const;
bool getInverted() const;
double getSecondaryMovementMultiplier() const;
double getWheelMovementMultiplier() const;
void setCamera(osg::Camera*);
void setCameraSensitivity(double value);
void setInverted(bool value);
void setSecondaryMovementMultiplier(double value);
void setWheelMovementMultiplier(double value);
@ -55,7 +57,7 @@ namespace CSVRender
private:
bool mActive;
bool mActive, mInverted;
double mCameraSensitivity;
double mSecondaryMoveMult;
double mWheelMoveMult;

@ -318,11 +318,22 @@ void SceneWidget::update(double dt)
void SceneWidget::settingChanged (const CSMPrefs::Setting *setting)
{
if (*setting=="3D Scene Input/p-navi-sensitivity")
if (*setting=="3D Scene Input/p-navi-free-sensitivity")
{
mFreeCamControl->setCameraSensitivity(setting->toDouble());
}
else if (*setting=="3D Scene Input/p-navi-orbit-sensitivity")
{
mOrbitCamControl->setCameraSensitivity(setting->toDouble());
}
else if (*setting=="3D Scene Input/p-navi-free-invert")
{
mFreeCamControl->setInverted(setting->isTrue());
}
else if (*setting=="3D Scene Input/p-navi-orbit-invert")
{
mOrbitCamControl->setInverted(setting->isTrue());
}
else if (*setting=="3D Scene Input/s-navi-sensitivity")
{
mFreeCamControl->setSecondaryMovementMultiplier(setting->toDouble());

Loading…
Cancel
Save