diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-10 21:44:58 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-10 21:44:58 +0000 |
commit | 17e9ce54ee3972b9804174b874652ec0856efcd0 (patch) | |
tree | 33ec140d65fdcf42a467e3903647efc1be0d4e02 | |
parent | d3afb677b6ea5942c042b8a83aa5d9ace1dec787 (diff) |
interpolation & oscilating debugging
-rw-r--r-- | TODO | 10 | ||||
-rw-r--r-- | osirion.kdevelop.pcs | bin | 656442 -> 655486 bytes | |||
-rw-r--r-- | osirion.kdevses | 33 | ||||
-rw-r--r-- | src/client/camera.cc | 48 | ||||
-rw-r--r-- | src/game/ship.cc | 33 | ||||
-rw-r--r-- | src/render/draw.cc | 2 |
6 files changed, 74 insertions, 52 deletions
@@ -8,13 +8,18 @@ milestone 1: camera frustum clip keyboard binds +milestone 2: + server-client event system, hit-once lightweight entities + explosion events + weapons fire events + filesystem: write a filesystem based on streams write handlers for zip model: split map loader from model - support map classes (e.g. func_rotate) + support map classes (e.g. func_rotate), requires class VertexData engine flare key core: @@ -58,6 +63,9 @@ render: add small camera light, fix lighting without sun +sound: + sound would be nice + win32 port: network not functional (ok) texture loading is broken (ok) diff --git a/osirion.kdevelop.pcs b/osirion.kdevelop.pcs Binary files differindex c7807ad..96a6daf 100644 --- a/osirion.kdevelop.pcs +++ b/osirion.kdevelop.pcs diff --git a/osirion.kdevses b/osirion.kdevses index 287f188..20dfedd 100644 --- a/osirion.kdevses +++ b/osirion.kdevses @@ -1,37 +1,28 @@ <?xml version = '1.0' encoding = 'UTF-8'?> <!DOCTYPE KDevPrjSession> <KDevPrjSession> - <DocsAndViews NumberOfDocuments="10" > - <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/render/draw.cc" > + <DocsAndViews NumberOfDocuments="7" > + <Doc0 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/input.cc" > <View0 Encoding="" Type="Source" /> </Doc0> - <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/model/plane.cc" > - <View0 Encoding="" line="0" Type="Source" /> + <Doc1 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/view.cc" > + <View0 Encoding="" line="59" Type="Source" /> </Doc1> - <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/model/plane.h" > - <View0 Encoding="" line="39" Type="Source" /> + <Doc2 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameinterface.cc" > + <View0 Encoding="" Type="Source" /> </Doc2> - <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/clientstate.h" > + <Doc3 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/math/functions.h" > <View0 Encoding="" Type="Source" /> </Doc3> - <Doc4 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/clientstate.cc" > + <Doc4 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/game/ship.cc" > <View0 Encoding="" Type="Source" /> </Doc4> - <Doc5 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/camera.cc" > - <View0 Encoding="" Type="Source" /> + <Doc5 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/TODO" > + <View0 Encoding="" line="15" Type="Source" /> </Doc5> - <Doc6 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameinterface.cc" > - <View0 Encoding="" line="141" Type="Source" /> + <Doc6 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/client/client.cc" > + <View0 Encoding="" line="0" Type="Source" /> </Doc6> - <Doc7 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/gameconnection.cc" > - <View0 Encoding="" line="104" Type="Source" /> - </Doc7> - <Doc8 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/netconnection.cc" > - <View0 Encoding="" Type="Source" /> - </Doc8> - <Doc9 NumberOfViews="1" URL="file:///home/ingar/projects/osirion/osirion-work/src/core/entity.cc" > - <View0 Encoding="" line="142" Type="Source" /> - </Doc9> </DocsAndViews> <pluginList> <kdevdebugger> diff --git a/src/client/camera.cc b/src/client/camera.cc index 28f60c5..c4a60b0 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -178,28 +178,43 @@ void draw(float seconds) } if (mode == Track) { - if (core::localcontrol()->state() && core::localcontrol()->model()) - target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->state()->axis().forward(); + if (core::localcontrol()->state() && core::localcontrol()->model()) { + target -= (core::localcontrol()->model()->maxbbox().x + 0.1f) * core::localcontrol()->state()->axis().forward(); + + target += (core::localcontrol()->model()->maxbbox().z + 0.3f ) * + core::localcontrol()->state()->axis().up(); + } // make the camera swing while turning target_direction = core::localcontrol()->target_direction; - pitch_target = core::localcontrol()->target_pitch; + target_pitch = core::localcontrol()->target_pitch; + + yaw_target = - 30 * target_direction; + pitch_target = - 30 * target_pitch; + //pitch_target = pitch_track - 30 * target_pitch; - yaw_target = - 25 * target_direction; - pitch_target = pitch_track - 25 * target_pitch; + distance = 0.0f; } else if (mode == Free) { yaw_target = yaw_current - 90 * target_direction; pitch_target = pitch_current - 90 * target_pitch; + + if (core::localcontrol()->model()) { + distance = core::localcontrol()->model()->radius(); + } else { + distance = 1.0f; + } } else if (mode == Cockpit) { if (core::localcontrol()->state() && core::localcontrol()->model()) - target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->state()->axis().forward(); + target += core::localcontrol()->model()->maxbbox().x * + core::localcontrol()->state()->axis().forward(); + + distance = 0.0f; } - if (mode != Cockpit) { // adjust direction d = degrees180f(yaw_current - yaw_target); @@ -210,11 +225,6 @@ void draw(float seconds) d = degrees180f(pitch_current - pitch_target); pitch_current = degrees360f(pitch_current - d *seconds); axis.change_pitch(pitch_current); - - if (core::localcontrol()->model()) - distance = 1+core::localcontrol()->model()->radius(); - else - distance = 1.5f; } } @@ -231,15 +241,13 @@ void draw(float seconds) // match the camera with the current target gl::translate(-1.0f * target); - if (mode != Cockpit) { - // apply camera offset - gl::translate((1.0f+distance) * axis.forward()); + // apply camera offset + gl::translate((1.0 + distance) * axis.forward()); + + // calculate eye position + eye = target - ((1.0f+distance) * axis.forward()); + eye.assign(target); - // calculate eye position - eye = target - ((1.0f+distance) * axis.forward()); - } else { - eye.assign(target); - } } void set_direction(float direction) diff --git a/src/game/ship.cc b/src/game/ship.cc index 525bf71..5c36205 100644 --- a/src/game/ship.cc +++ b/src/game/ship.cc @@ -47,12 +47,17 @@ void Ship::frame(float seconds) // update pitch math::clamp(target_pitch, -1.0f, 1.0f); - if (current_target_pitch - target_pitch < 0) { + if (current_target_pitch < target_pitch) { current_target_pitch += direction_change_speed * seconds; - } else if (current_target_pitch - target_pitch > 0) { + if (current_target_pitch > target_pitch) + current_target_pitch = target_pitch; + } else if (current_target_pitch > target_pitch) { current_target_pitch -= direction_change_speed * seconds; + if (current_target_pitch < target_pitch) + current_target_pitch = target_pitch; } - if (fabs(current_target_pitch) < direction_change_speed * seconds) { + + if (fabs(seconds*current_target_pitch) < 0.00005f) { current_target_pitch = 0.0f; } else { math::clamp(current_target_pitch, -1.0f, 1.0f); @@ -62,12 +67,18 @@ void Ship::frame(float seconds) // update direction math::clamp(target_direction, -1.0f, 1.0f); - if (current_target_direction - target_direction < 0) { + if (current_target_direction < target_direction) { current_target_direction += direction_change_speed * seconds; - } else if (current_target_direction - target_direction > 0) { + if (current_target_direction > target_direction) { + current_target_direction = target_direction; + } + } else if (current_target_direction > target_direction) { current_target_direction -= direction_change_speed * seconds; + if (current_target_direction < target_direction) { + current_target_direction = target_direction; + } } - if (fabs(current_target_direction) < direction_change_speed * seconds) { + if (fabs(seconds*current_target_direction) < 0.00005f) { current_target_direction = 0.0f; } else { math::clamp(current_target_direction, -1.0f, 1.0f); @@ -77,12 +88,16 @@ void Ship::frame(float seconds) // update roll math::clamp(target_roll, -1.0f, 1.0f); - if (current_target_roll - target_roll < 0) { + if (current_target_roll < target_roll) { current_target_roll += direction_change_speed * seconds; - } else if (current_target_roll - target_roll > 0) { + if (current_target_roll > target_roll) + current_target_roll = target_roll; + } else if (current_target_roll > target_roll) { current_target_roll -= direction_change_speed * seconds; + if (current_target_roll < target_roll) + current_target_roll = target_roll; } - if (fabs(current_target_roll) < direction_change_speed * seconds) { + if (fabs(current_target_roll) < 0.00005f) { current_target_roll = 0.0f; } else { math::clamp(current_target_roll, -1.0f, 1.0f); diff --git a/src/render/draw.cc b/src/render/draw.cc index 7a780bf..e2037e2 100644 --- a/src/render/draw.cc +++ b/src/render/draw.cc @@ -515,7 +515,7 @@ void draw_pass_model_corona() for (std::map<unsigned int, core::Entity *>::iterator it=core::Entity::registry.begin(); it != core::Entity::registry.end(); it++) { core::Entity *entity = (*it).second; - if ((entity->shape() != core::Entity::Sphere) && entity->state() && entity->state()->visible()) { + if (entity->model() && entity->state() && entity->state()->visible()) { gl::push(); gl::translate(entity->state()->location()); math::Color color = entity->color(); |