Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/camera.cc')
-rw-r--r--src/render/camera.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc
index c136375..f97ea96 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -43,6 +43,7 @@ float Camera::pitch_target;
float Camera::target_pitch;
float Camera::distance;
+float Camera::camera_zoom;
void Camera::init()
{
@@ -59,6 +60,7 @@ void Camera::init()
target_direction = 0.0f;
distance = 0.4f;
+ camera_zoom = 1.0f;
camera_mode = Overview;
camera_previous_mode = Track;
@@ -192,6 +194,13 @@ void Camera::view_previous()
break;
}
}
+
+void Camera::set_zoom(float zoom)
+{
+ camera_zoom += zoom;
+ math::clamp(camera_zoom, 1.0f, 10.0f);
+}
+
void Camera::frame(float seconds)
{
math::Axis target_axis;
@@ -245,6 +254,8 @@ void Camera::frame(float seconds)
if (mode() == Track) {
+ distance *= camera_zoom;
+
float cosangle; // cosine of an angle
float angle; // angle in radians
math::Vector3f n; // normal of a plane
@@ -297,7 +308,7 @@ void Camera::frame(float seconds)
pitch_current = degrees360f(pitch_current - d * seconds);
camera_axis.change_pitch(pitch_current);
- distance = 1.5f * core::localcontrol()->radius();
+ distance = 1.5f * core::localcontrol()->radius() * camera_zoom;
} else if (mode() == Cockpit) {