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/camera.cc
parent27ab3566118e77754fefb32a41ee06cf24a59dfe (diff)
docking, bumps network protocol version
Diffstat (limited to 'src/render/camera.cc')
-rw-r--r--src/render/camera.cc48
1 files changed, 34 insertions, 14 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());