Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/camera.cc8
-rw-r--r--src/client/view.cc2
-rw-r--r--src/render/draw.cc15
-rw-r--r--src/render/draw.h2
4 files changed, 18 insertions, 9 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc
index fa81356..d264ddf 100644
--- a/src/client/camera.cc
+++ b/src/client/camera.cc
@@ -152,10 +152,16 @@ void draw(float elapsed)
if (mode == Overview)
set_mode(Track);
- target.assign(core::localcontrol()->location());
+ target.assign(core::localcontrol()->location());
axis.assign(core::localcontrol()->axis());
+ if (mode == Track) {
+ // make the camera swing while turning
+ yaw_target = 25 * core::localcontrol()->target_direction;
+ pitch_target = pitch_track - 25 * core::localcontrol()->target_pitch;
+ }
+
// adjust direction
d = degrees180f(yaw_current - yaw_target);
yaw_current = degrees360f( yaw_current - d * elapsed);
diff --git a/src/client/view.cc b/src/client/view.cc
index e8ec5e8..39cd351 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -268,7 +268,7 @@ void frame(float seconds)
camera::draw(seconds); // draw the current camera transformation
- render::draw(camera::target, seconds); // draw the world
+ render::draw(camera::eye, camera::target, seconds); // draw the world
}
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 5b64497..4b42596 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -35,6 +35,8 @@ const float drawdistance = 128.0f;
const float drawfxdistance = 32.0f;
math::Vector3f camera_target;
+math::Vector3f camera_eye;
+
float angle = 0;
@@ -43,13 +45,13 @@ float angle = 0;
inline bool test_draw_distance(core::Entity *entity)
{
return (entity->model() &&
- (math::distancesquared(camera_target, entity->location()) <= (drawdistance*drawdistance*entity->model()->radius())));
+ (math::distancesquared(camera_eye, entity->location()) <= (drawdistance*drawdistance*entity->model()->radius())));
}
inline bool test_drawfx_distance(core::Entity *entity)
{
return (entity->model() &&
- (math::distancesquared(camera_target, entity->location()) <= (drawfxdistance*drawfxdistance*entity->model()->radius())));
+ (math::distancesquared(camera_eye, entity->location()) <= (drawfxdistance*drawfxdistance*entity->model()->radius())));
}
@@ -483,7 +485,7 @@ void draw_local_axis()
}
/* ----- Main draw routine ----------------------------------------- */
-void draw(math::Vector3f const &target, float seconds)
+void draw(math::Vector3f const &eye, math::Vector3f const &target, float seconds)
{
Stats::clear();
@@ -493,7 +495,8 @@ void draw(math::Vector3f const &target, float seconds)
angle -= 360.0f;
}
- camera_target = target;
+ camera_target.assign(target);
+ camera_eye.assign(eye);
gl::enable(GL_DEPTH_TEST); // enable depth buffer writing
gl::enable(GL_CULL_FACE); // enable culling
@@ -545,11 +548,11 @@ void draw(math::Vector3f const &target, float seconds)
gl::disable(GL_COLOR_MATERIAL); // disable color tracking
gl::disable(GL_CULL_FACE); // disable culling
- draw_local_axis();
+ // draw_local_axis();
draw_pass_spacegrid(); // draw the blue spacegrid
- gl::disable(GL_DEPTH_TEST); // disable depth buffer writing
+ gl::disable(GL_DEPTH_TEST); // disable depth buffer
// GL_BLEND must be enabled for the GUI
}
diff --git a/src/render/draw.h b/src/render/draw.h
index 6db1c9b..b423aad 100644
--- a/src/render/draw.h
+++ b/src/render/draw.h
@@ -13,7 +13,7 @@ namespace render
{
/// draw the world
-void draw(math::Vector3f const &target, float seconds);
+void draw(math::Vector3f const &eye, math::Vector3f const &target, float seconds);
class Stats {
public: