00001 /*************************************************************************** 00002 * Copyright (C) 2004-2005 by Reality Rift Studios * 00003 * http://www.realityrift.com - mattias@realityrift.com * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 00021 #ifndef neo_scene_chasecamera_h 00022 #define neo_scene_chasecamera_h 00023 00029 #include "../core/platform.h" 00030 00031 #if NEO_ENABLE_SCENE 00032 00033 #include "camera.h" 00034 00035 namespace neo { 00036 namespace scene { 00037 00039 00041 class ChaseCamera : public Camera 00042 { 00043 public: 00044 00046 00047 ChaseCamera( const std::string& name ); 00048 00050 virtual ~ChaseCamera(); 00051 00053 00056 Object* setTarget( Object* p_object ); 00057 00059 00062 Object* setTargetByName( const std::string& object ); 00063 00065 00066 inline Object* getTarget(); 00067 00069 00071 virtual void update( float dt ); 00072 00074 00077 virtual void rotate( float azimuth, float polar ); 00078 00080 00082 virtual void zoom( float radius ); 00083 00085 00087 virtual void pan( const math::Vector3& offset ); 00088 00090 00094 virtual void setSensitivity( float pan, float zoom, float rotate ); 00095 00097 00099 void setRadius( float radius ); 00100 00102 00105 void setRotation( float azimuth, float polar ); 00106 00108 00110 void setOffset( const math::Vector3& offset ); 00111 00113 00114 inline float getRadius() const; 00115 00117 00119 inline float getRotationAzimuth() const; 00120 00122 00124 inline float getRotationPolar() const; 00125 00127 00129 inline const math::Vector3& getOffset() const; 00130 00132 00133 inline float getSensitivityPan() const; 00134 00136 00137 inline float getSensitivityZoom() const; 00138 00140 00141 inline float getSensitivityRotate() const; 00142 00144 00146 virtual ChaseCamera* clone() const; 00147 00149 00152 virtual void set( const core::HashString& name, const core::Any& data ); 00153 00155 00158 virtual const core::Any& get( const core::HashString& name ); 00159 00160 protected: 00161 00163 Object* _p_target; 00164 00166 std::string _target; 00167 00169 math::Vector3 _offset; 00170 00172 float _sensPan; 00173 00175 float _sensZoom; 00176 00178 float _sensRotation; 00179 00181 float _radius; 00182 00184 float _azimuth; 00185 00187 float _polar; 00188 00191 void copyFrom( const ChaseCamera& obj ); 00192 }; 00193 00194 #include "chasecamera.inl" 00195 00196 } 00197 } 00198 00199 #endif 00200 00201 #endif
1.5.1