aboutsummaryrefslogtreecommitdiffhomepage
path: root/demos/opengl/camera.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'demos/opengl/camera.cpp')
-rw-r--r--demos/opengl/camera.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/demos/opengl/camera.cpp b/demos/opengl/camera.cpp
index 26118e6ba..f704771b6 100644
--- a/demos/opengl/camera.cpp
+++ b/demos/opengl/camera.cpp
@@ -42,8 +42,7 @@ Camera::Camera()
mVpX = 0;
mVpY = 0;
- setPosition(Vector3f::Constant(50.));
-
+ setPosition(Vector3f::Constant(100.));
setTarget(Vector3f::Zero());
}
@@ -179,6 +178,14 @@ void Camera::rotateAroundTarget(const Quaternionf& q)
mViewIsUptodate = true;
}
+void Camera::localRotate(const Quaternionf& q)
+{
+ float dist = (position() - mTarget).norm();
+ setOrientation(orientation() * q);
+ mTarget = position() + dist * direction();
+ mViewIsUptodate = false;
+}
+
void Camera::zoom(float d)
{
float dist = (position() - mTarget).norm();