00001 //------------------------------------------------------------------------------ 00002 // Lamp : Open source game middleware 00003 // Copyright (C) 2004 Junpei Ohtani ( Email : junpee@users.sourceforge.jp ) 00004 // 00005 // This library is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU Lesser General Public 00007 // License as published by the Free Software Foundation; either 00008 // version 2.1 of the License, or (at your option) any later version. 00009 // 00010 // This library 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 GNU 00013 // Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public 00016 // License along with this library; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 //------------------------------------------------------------------------------ 00019 00020 /** @file 00021 * カメラアニメーションヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef CAMERA_ANIMATION_H_ 00026 #define CAMERA_ANIMATION_H_ 00027 00028 #include <Animation/System/ObjectAnimation.h> 00029 #include <Animation/Camera/CameraAnimationData.h> 00030 00031 namespace Lamp{ 00032 00033 class Camera; 00034 00035 //------------------------------------------------------------------------------ 00036 /** 00037 * カメラアニメーション 00038 */ 00039 class CameraAnimation : public ObjectAnimation{ 00040 friend class AnimationManager; 00041 public: 00042 //-------------------------------------------------------------------------- 00043 // アニメーションデータ 00044 //-------------------------------------------------------------------------- 00045 /** 00046 * アニメーションデータの取得 00047 * @return アニメーションデータ 00048 */ 00049 virtual AnimationData* getAnimationData(){ return animationData_; } 00050 00051 /** 00052 * アニメーションデータの取得 00053 * @return アニメーションデータ 00054 */ 00055 virtual const AnimationData* getAnimationData() const{ 00056 return animationData_; 00057 } 00058 00059 //-------------------------------------------------------------------------- 00060 // カメラアニメーションデータ 00061 //-------------------------------------------------------------------------- 00062 /** 00063 * カメラアニメーションデータの設定 00064 * @param animationData カメラアニメーションデータ 00065 */ 00066 virtual void setCameraAnimationData(CameraAnimationData* animationData){ 00067 if(animationData_ != NULL){ animationData_->removeReference(); } 00068 animationData_ = animationData; 00069 if(animationData_ != NULL){ animationData_->addReference(); } 00070 } 00071 00072 /** 00073 * カメラアニメーションデータの取得 00074 * @return カメラアニメーションデータ 00075 */ 00076 virtual CameraAnimationData* getCameraAnimationData(){ 00077 return animationData_; 00078 } 00079 00080 /** 00081 * カメラアニメーションデータの取得 00082 * @return カメラアニメーションデータ 00083 */ 00084 virtual const CameraAnimationData* getCameraAnimationData() const{ 00085 return animationData_; 00086 } 00087 00088 //-------------------------------------------------------------------------- 00089 // バインド 00090 //-------------------------------------------------------------------------- 00091 /** 00092 * バインド 00093 * @param scene バインド対象シーン 00094 * @return 成功すればtrue 00095 */ 00096 virtual bool bind(Scene* scene); 00097 00098 /** 00099 * バインド 00100 * @param camera バインド対象カメラ 00101 * @return 成功すればtrue 00102 */ 00103 virtual bool bind(Camera* camera); 00104 00105 /** 00106 * バインド解除 00107 */ 00108 virtual void unbind(){ target_ = NULL; } 00109 00110 /** 00111 * ターゲットの取得 00112 * @return ターゲット 00113 */ 00114 virtual Camera* getTarget() const{ return target_; } 00115 00116 //-------------------------------------------------------------------------- 00117 // アニメーション 00118 //-------------------------------------------------------------------------- 00119 /** 00120 * アニメーション 00121 * @param deltaTime デルタタイム 00122 * @param mask アニメーションマスク 00123 * @return アニメーションが終了していればtrue 00124 */ 00125 virtual bool animate(float deltaTime, AnimationMask mask); 00126 00127 //-------------------------------------------------------------------------- 00128 // コピー 00129 //-------------------------------------------------------------------------- 00130 /** 00131 * コピー 00132 * @param dataCopyMask データコピーマスク 00133 * @return コピーされたアニメーション 00134 */ 00135 virtual Animation* copy(DataCopyMask dataCopyMask = copyNone) const{ 00136 return copyCameraAnimation(dataCopyMask); 00137 } 00138 00139 /** 00140 * カメラアニメーションのコピー 00141 * @param dataCopyMask データコピーマスク 00142 * @return コピーされたアニメーション 00143 */ 00144 virtual CameraAnimation* copyCameraAnimation( 00145 DataCopyMask dataCopyMask = copyNone) const; 00146 00147 //-------------------------------------------------------------------------- 00148 // RTTI 00149 //-------------------------------------------------------------------------- 00150 /** 00151 * カメラアニメーションかどうか 00152 * @return カメラアニメーションならtrue 00153 */ 00154 virtual bool isCameraAnimation() const{ return true; } 00155 00156 //-------------------------------------------------------------------------- 00157 protected: 00158 /** 00159 * コンストラクタ 00160 * @param name 名前 00161 * @param manager アニメーションマネージャ 00162 */ 00163 CameraAnimation(String name, AnimationManager* manager); 00164 00165 /** 00166 * デストラクタ 00167 */ 00168 virtual ~CameraAnimation(); 00169 00170 private: 00171 // アニメーションデータ 00172 CameraAnimationData* animationData_; 00173 // ターゲット 00174 Camera* target_; 00175 00176 }; 00177 00178 //------------------------------------------------------------------------------ 00179 } // End of namespace Lamp 00180 #endif // End of CAMERA_ANIMATION_H_ 00181 //------------------------------------------------------------------------------ 00182