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>2015-02-28 20:46:53 +0000
committerStijn Buys <ingar@osirion.org>2015-02-28 20:46:53 +0000
commitcffe02f49b66a70d40816ffc8dea42f9e52da57f (patch)
tree110471c23944d09899d4cacb3cdd40508f359f72 /src/render/renderext.cc
parent26c8cf4d74062fb12871ae9d5298d8ceaab7a2cf (diff)
Reimplemented camera handling enabling 360-degree freelook.
Diffstat (limited to 'src/render/renderext.cc')
-rw-r--r--src/render/renderext.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/render/renderext.cc b/src/render/renderext.cc
index c66f036..c311be9 100644
--- a/src/render/renderext.cc
+++ b/src/render/renderext.cc
@@ -103,7 +103,11 @@ RenderExt::~RenderExt()
void RenderExt::frame(float elapsed)
{
- state_distance = math::distance(Camera::eye(), entity()->location());
+}
+
+void RenderExt::frame(float elapsed, const Camera & camera)
+{
+ state_distance = math::distance(camera.location(), entity()->location());
state_visible = entity()->visible();
state_detailvisible = false;
@@ -139,7 +143,7 @@ void RenderExt::frame(float elapsed)
return;
}
- if ((controlable == core::localcontrol()) && (Camera::mode() == Camera::Cockpit)) {
+ if ((controlable == core::localcontrol()) && (camera.mode() == camera.Cockpit)) {
state_visible = false;
return;
}
@@ -233,7 +237,7 @@ void RenderExt::frame(float elapsed)
}
}
- if (math::dotproduct(Camera::axis().forward(), entity()->location() + Camera::axis().forward() * entity()->radius() - Camera::eye()) < 0.0f) {
+ if (math::dotproduct(camera.axis().forward(), entity()->location() + camera.axis().forward() * entity()->radius() - camera.location()) < 0.0f) {
state_behind = true;
}
}