Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2007-10-20 11:03:53 +0000
committerStijn Buys <ingar@osirion.org>2007-10-20 11:03:53 +0000
commit5d166c464a2441c4baa1ce1dbc090b4c695a85d6 (patch)
tree54ab0a2ddb0fcdcaf6e7e4f9f622e1a339e6e399 /src
parent89a997dc29ced5562370de385dba2a67b39398bd (diff)
Modified free camera behaviour
Diffstat (limited to 'src')
-rw-r--r--src/client/camera.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc
index ca60d18..1b4255f 100644
--- a/src/client/camera.cc
+++ b/src/client/camera.cc
@@ -28,16 +28,23 @@ float distance = 2.0f; // distance from the eye to the target
void draw(float elapsed)
{
- // adjust yaw target
- float yaw_target = game::ship.yaw - yaw_offset;
+ float yaw_target;
+ if (mode == Track) {
+ // track the target
+ yaw_target = game::ship.yaw - yaw_offset;
+ } else {
+ yaw_target = - yaw_offset;
+ }
+
+ // adjust yaw
float d = degreesf(yaw - yaw_target);
- yaw = degreesf( yaw - d * elapsed);
+ yaw = degreesf( yaw - d * elapsed) ;
// adjust pitch target
float pitch_target = 0.0f - pitch_offset;
- d= degreesf(pitch - pitch_target);
+ d = degreesf(pitch - pitch_target);
pitch = degreesf( pitch - d *elapsed);
-
+
/*
gl::translate(distance, 0.0, 0.0);
gl::rotate(-pitch,0, 0, 1.0 );
@@ -50,7 +57,8 @@ void draw(float elapsed)
gl::rotate(-yaw, 0, 1.0f, 0);
break;
case Track:
- gl::translate(1+distance* GAMESCALE, -0.5f* GAMESCALE, 0.0f);
+ //gl::translate(1+distance* GAMESCALE, -0.5f* GAMESCALE, 0.0f);
+ gl::translate(1+ 2* GAMESCALE, -0.5f* GAMESCALE, 0.0f);
gl::rotate(-pitch, 0, 0, 1.0f);
gl::rotate(-yaw, 0, 1.0f, 0);
break;
@@ -76,14 +84,16 @@ void rotate_left()
void rotate_up()
{
if (mode == Free ) {
- pitch_offset = degreesf( pitch_offset + offset_inc);
+ pitch_offset = pitch_offset + offset_inc;
+ if (pitch_offset > 90.0f) pitch_offset = 90.0f;
}
}
void rotate_down()
{
if (mode == Free ) {
- pitch_offset = degreesf( pitch_offset - offset_inc);
+ pitch_offset = pitch_offset - offset_inc;
+ if (pitch_offset < -90.0f) pitch_offset = -90.0f;
}
}