Add ability to set orbit camera center outside of class.

openmw-39
Aesylwinn 9 years ago
parent 02f991c63e
commit 4ef9981544

@ -367,6 +367,11 @@ namespace CSVRender
{ {
} }
osg::Vec3d OrbitCameraController::getCenter() const
{
return mCenter;
}
double OrbitCameraController::getOrbitSpeed() const double OrbitCameraController::getOrbitSpeed() const
{ {
return mOrbitSpeed; return mOrbitSpeed;
@ -382,6 +387,19 @@ namespace CSVRender
return mPickingMask; return mPickingMask;
} }
void OrbitCameraController::setCenter(const osg::Vec3d& value)
{
osg::Vec3d eye, center, up;
getCamera()->getViewMatrixAsLookAt(eye, center, up);
mCenter = value;
mDistance = (eye - mCenter).length();
getCamera()->setViewMatrixAsLookAt(eye, mCenter, up);
mInitialized = true;
}
void OrbitCameraController::setOrbitSpeed(double value) void OrbitCameraController::setOrbitSpeed(double value)
{ {
mOrbitSpeed = value; mOrbitSpeed = value;

@ -113,10 +113,12 @@ namespace CSVRender
OrbitCameraController(); OrbitCameraController();
osg::Vec3d getCenter() const;
double getOrbitSpeed() const; double getOrbitSpeed() const;
double getOrbitSpeedMultiplier() const; double getOrbitSpeedMultiplier() const;
unsigned int getPickingMask() const; unsigned int getPickingMask() const;
void setCenter(const osg::Vec3d& center);
void setOrbitSpeed(double value); void setOrbitSpeed(double value);
void setOrbitSpeedMultiplier(double value); void setOrbitSpeedMultiplier(double value);
void setPickingMask(unsigned int value); void setPickingMask(unsigned int value);

Loading…
Cancel
Save