Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-11-08 10:17:37 +0000
committerStijn Buys <ingar@osirion.org>2008-11-08 10:17:37 +0000
commit4cad4a27677b0490d3ba0018bc3404961f925ed5 (patch)
treef9d59542f27f66a9fb4c8938f40aec66994449fc /src/render
parent27ab3566118e77754fefb32a41ee06cf24a59dfe (diff)
docking, bumps network protocol version
Diffstat (limited to 'src/render')
-rw-r--r--src/render/camera.cc48
-rw-r--r--src/render/draw.cc60
2 files changed, 69 insertions, 39 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc
index 852e93f..04d899f 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -207,25 +207,45 @@ void Camera::frame(float seconds)
math::Axis target_axis;
float d = 0;
- if (!core::localcontrol()) {
-
+ if (core::localplayer()->view()) {
if (camera_mode != Overview) {
set_mode(Overview);
}
-
- // TODO read Zone overview positions
- camera_eye.clear();
- camera_target.clear();
- camera_axis.clear();
- pitch_current = pitch_overview;
- camera_axis.change_pitch(pitch_current);
-
- //distance = 20.0f;
- distance = 8.0f;
+ } else if (core::localcontrol()) {
+ if (camera_mode == Overview) {
+ set_mode(Track);
+ }
+ } else {
+ if (camera_mode != Overview) {
+ set_mode(Overview);
+ }
+ }
+ if (mode() == Overview) {
+ camera_eye.clear();
+
+ if (core::localplayer()->view()) {
+ // player view entity
+ camera_target.assign(core::localplayer()->view()->location());
+ camera_axis.assign(core::localplayer()->view()->axis());
+ camera_axis.change_direction(180.0f);
+ distance = math::max(core::localplayer()->view()->radius(), 1.0f) * 2.0f;
+
+ } else if (core::localplayer()->zone()->default_view()) {
+ // default zone view entity
+ camera_target.assign(core::localplayer()->zone()->default_view()->location());
+ camera_axis.assign(core::localplayer()->zone()->default_view()->axis());
+ camera_axis.change_direction(180.0f);
+ distance = math::max(core::localplayer()->zone()->default_view()->radius(), 1.0f) * 2.0f;
+ } else {
+ // default location (0,0,0)
+ camera_target.clear();
+ camera_axis.clear();
+ pitch_current = pitch_overview;
+ camera_axis.change_pitch(pitch_current);
+ distance = 8.0f;
+ }
} else {
- if (mode() == Overview)
- set_mode(Track);
camera_target.assign(core::localcontrol()->state()->location());
target_axis.assign(core::localcontrol()->state()->axis());
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 7bbb89c..1b1262f 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -112,32 +112,21 @@ void pass_prepare(float seconds)
}
}
- entity->state()->state_visible = false;
- entity->state()->state_detailvisible = false;
- entity->state()->state_targetable = false;
-
- entity->state()->state_distance = math::distance(Camera::eye(), entity->state()->location());
+ entity->state()->state_visible = entity->visible();
- // calculate visibility for entities with models
- if (entity->model()) {
-
- float r = entity->model()->radius();
- math::clamp(r, 1.0f, farplane / drawfxdistance);
- if (entity->state()->distance() < drawfxdistance * r) {
- // entites within detail range
- entity->state()->state_visible = true;
- entity->state()->state_detailvisible = true;
- } else if (entity->state()->distance() < drawdistance * r && entity->state()->distance() < core::range::max) {
- // entities within drawing distance, outside detail range
- entity->state()->state_visible = true;
- entity->state()->state_detailvisible = false;
+ if ((entity->type() == core::Entity::Controlable)) {
+ if (static_cast<core::EntityDynamic *>(entity)->eventstate() == core::Entity::Docked) {
+ entity->state()->state_visible = false;
}
+ }
- } else {
- entity->state()->state_visible = true;
+ entity->state()->state_detailvisible = false;
+ entity->state()->state_targetable = false;
+ entity->state()->state_distance = math::distance(Camera::eye(), entity->state()->location());
- if (entity->type() == core::Entity::Globe) {
-
+ if (entity->state()->visible()) {
+ // globes
+ if (entity->type() == core::Entity::Globe) {
core::EntityGlobe *globe = static_cast<core::EntityGlobe *>(entity);
// add the globe to the globes list
@@ -174,8 +163,26 @@ void pass_prepare(float seconds)
gl::enable(GL_LIGHT1);
has_zone_light = true;
}
- }
- }
+
+ } else if (entity->model()) {
+
+ float r = entity->model()->radius();
+ math::clamp(r, 1.0f, farplane / drawfxdistance);
+ if (entity->state()->distance() < drawfxdistance * r) {
+ // entites within detail range
+ entity->state()->state_visible = true;
+ entity->state()->state_detailvisible = true;
+ } else if (entity->state()->distance() < drawdistance * r && entity->state()->distance() < core::range::max) {
+ // entities within drawing distance, outside detail range
+ entity->state()->state_visible = true;
+ entity->state()->state_detailvisible = false;
+ } else {
+ // out of range
+ entity->state()->state_visible = false;
+ entity->state()->state_detailvisible = false;
+ }
+ }
+ }
}
}
@@ -1076,7 +1083,10 @@ void draw(float seconds)
gl::depthmask(GL_FALSE); // disable depth buffer writing
draw_pass_spacegrid(); // draw the blue spacegrid
- Dust::draw(zone_color); // draw spacedust
+
+ if (!core::localplayer()->view()) {
+ Dust::draw(zone_color); // draw spacedust
+ }
draw_pass_model_fx(seconds); // draw entity lights and engines