From 9a767dcdbe75918570e5a6af45a9d0d18c231e51 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Sat, 20 Feb 2010 01:42:32 +0000 Subject: [PATCH] Added support of far camera to stk, updated final camera handling of track exporter. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4775 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/camera.cpp | 1 + src/tracks/track.cpp | 5 +++++ src/tracks/track.hpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/graphics/camera.cpp b/src/graphics/camera.cpp index c0d98fd53..3974eed02 100644 --- a/src/graphics/camera.cpp +++ b/src/graphics/camera.cpp @@ -131,6 +131,7 @@ void Camera::setupCamera() } // switch m_camera->setFOV(m_fov); m_camera->setAspectRatio(m_aspect); + m_camera->setFarValue(World::getWorld()->getTrack()->getCameraFar()); } // setupCamera // ---------------------------------------------------------------------------- diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 7180015ab..e1dea5156 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -72,6 +72,7 @@ Track::Track(std::string filename) m_all_meshes.clear(); m_has_final_camera = false; m_is_arena = false; + m_camera_far = 1000.0f; m_quad_graph = NULL; m_animation_manager = NULL; m_check_manager = NULL; @@ -719,6 +720,10 @@ void Track::loadTrackModel(unsigned int mode_id) node->get("h", &h); m_start_heading.push_back(h); } + else if(name=="camera") + { + node->get("far", &m_camera_far); + } else if(name=="animations") { m_animation_manager = new AnimationManager(*this, *node); diff --git a/src/tracks/track.hpp b/src/tracks/track.hpp index 2d3f5050d..dc043c9b2 100644 --- a/src/tracks/track.hpp +++ b/src/tracks/track.hpp @@ -89,6 +89,8 @@ private: /** The version of this track. A certain STK version will only support * certain track versions. */ int m_version; + /** Far value for cameras for this track. */ + float m_camera_far; /** The graph used to connect the quads. */ QuadGraph *m_quad_graph; @@ -267,6 +269,9 @@ public: /** Sets the current ambient color for a kart with index k. */ void setAmbientColor(const video::SColor &color, unsigned int k); + /** Returns the far value for cameras. */ + float getCameraFar() const { return m_camera_far; } + /** Get the number of start positions defined in the scene file. */ unsigned int getNumberOfStartPositions() const { return m_start_positions.size(); }