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>2009-03-08 15:07:56 +0000
committerStijn Buys <ingar@osirion.org>2009-03-08 15:07:56 +0000
commit22d6abef8b95c1ff301f657751c1f1882bca89fb (patch)
treeba42668d0e8fe7f7108c05075ea38f642fbfa5d9 /src/client/targets.cc
parent974631a33120837165e6ad04bd0ff6acaec08ffa (diff)
fixes hud selection
Diffstat (limited to 'src/client/targets.cc')
-rw-r--r--src/client/targets.cc49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/client/targets.cc b/src/client/targets.cc
index 08c0e14..8a50510 100644
--- a/src/client/targets.cc
+++ b/src/client/targets.cc
@@ -361,35 +361,36 @@ void frame()
if (entity->id() == current_target_id) {
current_target = entity;
+ }
- // check if the mouse is hovering the entity
- Vector3f v(entity->location() - render::Camera::eye());
- v.normalize();
-
- if (math::dotproduct(render::Camera::axis().forward(), v) > 0.75 ) {
-
- // calculate the distance from entity location to the line [eye - cursor]
- float d = math::Vector3f::length(math::crossproduct( (cursor - render::Camera::eye()) , (render::Camera::eye() - entity->location()))) / math::Vector3f::length(cursor - render::Camera::eye());
-
- float r = entity->radius() * 0.5f;
-
- if (ext_render(entity)->distance() > 512.0f)
- math::clamp(r, 8.0f,r);
- else if (ext_render(entity)->distance() > 256.0f)
- math::clamp(r, 4.0f,r);
- else if (ext_render(entity)->distance() > 128.0f)
- math::clamp(r, 2.0f,r);
+ // check if the mouse is hovering the entity
+ Vector3f v(entity->location() - render::Camera::eye());
+ v.normalize();
+
+ if (math::dotproduct(render::Camera::axis().forward(), v) > 0.75 ) {
+
+ // calculate the distance from entity location to the line [eye - cursor]
+ float d = math::Vector3f::length(math::crossproduct( (cursor - render::Camera::eye()) , (render::Camera::eye() - entity->location()))) / math::Vector3f::length(cursor - render::Camera::eye());
- // if the cursor-beam hits the entity sphere
- if (d < r) {
- float myz = math::distance(cursor, entity->location());
- if (z < 0 || myz < z) {
- current_hover = entity->id();
- z = myz;
- }
+ float r = entity->radius() * 0.5f;
+
+ if (ext_render(entity)->distance() > 512.0f)
+ math::clamp(r, 8.0f,r);
+ else if (ext_render(entity)->distance() > 256.0f)
+ math::clamp(r, 4.0f,r);
+ else if (ext_render(entity)->distance() > 128.0f)
+ math::clamp(r, 2.0f,r);
+
+ // if the cursor-beam hits the entity sphere
+ if (d < r) {
+ float myz = math::distance(cursor, entity->location());
+ if (z < 0 || myz < z) {
+ current_hover = entity->id();
+ z = myz;
}
}
}
+
}
}