diff options
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/camera.cc | 11 | ||||
-rw-r--r-- | src/render/renderext.cc | 8 |
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; } |