aboutsummaryrefslogtreecommitdiffhomepage
path: root/demos/opengl/camera.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-09-09 18:50:45 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-09-09 18:50:45 +0000
commit146c9e449443453f3932b60cd1bab47f688403e7 (patch)
treef7f18d29a7a7755515db377b5de9658899de66bb /demos/opengl/camera.cpp
parentd3a70b7facea2919b5ee0451d3c639dedb00ea30 (diff)
various stuff in opengl demos such as a better model,
stable trackball for the fly navigation mode, and started to put some GUI elements...
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();