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>2010-11-13 00:29:04 +0000
committerStijn Buys <ingar@osirion.org>2010-11-13 00:29:04 +0000
commitbbf1d9537e7b7817b41601968f8852a0f811c30a (patch)
tree2af6b33df5c6db211cdbc7e55b0543a8eccfd5b2 /src
parent82bc4da2b81077ddfc40c1ee37c57033010c9eef (diff)
corrected distance scaling in Cockpit and Track camera view
Diffstat (limited to 'src')
-rw-r--r--src/render/camera.cc11
-rw-r--r--src/render/renderext.cc8
2 files changed, 14 insertions, 5 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc
index 37453b9..3d7c452 100644
--- a/src/render/camera.cc
+++ b/src/render/camera.cc
@@ -289,9 +289,11 @@ void Camera::frame(float seconds)
camera_axis.rotate(n, -angle);
}
- if (core::localcontrol()->model()) {
- camera_target -= camera_axis.forward() * math::max(FRUSTUMFRONT / WORLDSCALE, core::localcontrol()->model()->box().max().x());
- camera_target += camera_axis.up() * math::max(FRUSTUMFRONT / WORLDSCALE, core::localcontrol()->model()->box().max().z() * 2.0f);
+ if (core::localcontrol()->model() && core::localcontrol()->model()->radius()) {
+ const float modelscale = core::localcontrol()->radius() / core::localcontrol()->model()->radius();
+
+ camera_target -= camera_axis.forward() * math::max(FRUSTUMFRONT / WORLDSCALE, core::localcontrol()->model()->box().max().x() * modelscale);
+ camera_target += camera_axis.up() * math::max(FRUSTUMFRONT / WORLDSCALE, core::localcontrol()->model()->box().max().z() * modelscale);
} else {
camera_target -= camera_axis.forward() * math::max(FRUSTUMFRONT / WORLDSCALE, FRUSTUMFRONT / WORLDSCALE + core::localcontrol()->radius());
camera_target += camera_axis.up() * math::max(FRUSTUMFRONT / WORLDSCALE, FRUSTUMFRONT / WORLDSCALE + core::localcontrol()->radius());
@@ -323,7 +325,8 @@ void Camera::frame(float seconds)
camera_axis.assign(target_axis);
if (core::localcontrol()->model()) {
- camera_target += (core::localcontrol()->model()->box().max().x()) *
+ const float modelscale = core::localcontrol()->radius() / core::localcontrol()->model()->radius();
+ camera_target += (core::localcontrol()->model()->box().max().x() * modelscale) *
core::localcontrol()->axis().forward();
} else {
camera_target += (core::localcontrol()->radius()) *
diff --git a/src/render/renderext.cc b/src/render/renderext.cc
index 29997ca..5f24e85 100644
--- a/src/render/renderext.cc
+++ b/src/render/renderext.cc
@@ -11,6 +11,7 @@
#include "core/application.h"
#include "core/range.h"
#include "model/model.h"
+#include "render/camera.h"
#include "render/renderext.h"
#include "render/render.h"
#include "render/textures.h"
@@ -130,7 +131,12 @@ void RenderExt::frame(float elapsed)
state_visible = false;
return;
}
-
+/*
+ if ((controlable == core::localcontrol()) && (Camera::mode() == Camera::Cockpit)) {
+ state_visible = false;
+ return;
+ }
+*/
if ((controlable->state() == core::Entity::NoPower) || (controlable->state() == core::Entity::Destroyed)) {
state_power = false;
}