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 SCENE_NODE_ANIMATION_H_ 00026 #define SCENE_NODE_ANIMATION_H_ 00027 00028 #include <Animation/System/ObjectAnimation.h> 00029 #include <Animation/SceneNode/SceneNodeAnimationData.h> 00030 00031 namespace Lamp{ 00032 00033 class SceneNode; 00034 00035 //------------------------------------------------------------------------------ 00036 /** 00037 * シーンノードアニメーション 00038 */ 00039 class SceneNodeAnimation : 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 setSceneNodeAnimationData( 00067 SceneNodeAnimationData* animationData){ 00068 if(animationData_ != NULL){ animationData_->removeReference(); } 00069 animationData_ = animationData; 00070 if(animationData_ != NULL){ animationData_->addReference(); } 00071 } 00072 00073 /** 00074 * シーンノードアニメーションデータの取得 00075 * @return シーンノードアニメーションデータ 00076 */ 00077 virtual SceneNodeAnimationData* getSceneNodeAnimationData(){ 00078 return animationData_; 00079 } 00080 00081 /** 00082 * シーンノードアニメーションデータの取得 00083 * @return シーンノードアニメーションデータ 00084 */ 00085 virtual const SceneNodeAnimationData* getSceneNodeAnimationData() const{ 00086 return animationData_; 00087 } 00088 00089 //-------------------------------------------------------------------------- 00090 // バインド 00091 //-------------------------------------------------------------------------- 00092 /** 00093 * バインド 00094 * @param scene バインド対象シーン 00095 * @return 成功すればtrue 00096 */ 00097 virtual bool bind(Scene* scene); 00098 00099 /** 00100 * バインド 00101 * @param sceneNode バインド対象シーンノード 00102 * @return 成功すればtrue 00103 */ 00104 virtual bool bind(SceneNode* sceneNode); 00105 00106 /** 00107 * バインド解除 00108 */ 00109 virtual void unbind(){ target_ = NULL; } 00110 00111 /** 00112 * ターゲットの取得 00113 * @return ターゲット 00114 */ 00115 virtual SceneNode* getTarget() const{ return target_; } 00116 00117 //-------------------------------------------------------------------------- 00118 // アニメーション 00119 //-------------------------------------------------------------------------- 00120 /** 00121 * アニメーション 00122 * @param deltaTime デルタタイム 00123 * @param mask アニメーションマスク 00124 * @return アニメーションが終了していればtrue 00125 */ 00126 virtual bool animate(float deltaTime, AnimationMask mask); 00127 00128 //-------------------------------------------------------------------------- 00129 // コピー 00130 //-------------------------------------------------------------------------- 00131 /** 00132 * コピー 00133 * @param dataCopyMask データコピーマスク 00134 * @return コピーされたアニメーション 00135 */ 00136 virtual Animation* copy(DataCopyMask dataCopyMask = copyNone) const{ 00137 return copySceneNodeAnimation(dataCopyMask); 00138 } 00139 00140 /** 00141 * シーンノードアニメーションのコピー 00142 * @param dataCopyMask データコピーマスク 00143 * @return コピーされたアニメーション 00144 */ 00145 virtual SceneNodeAnimation* copySceneNodeAnimation( 00146 DataCopyMask dataCopyMask = copyNone) const; 00147 00148 //-------------------------------------------------------------------------- 00149 // RTTI 00150 //-------------------------------------------------------------------------- 00151 /** 00152 * シーンノードアニメーションかどうか 00153 * @return シーンノードアニメーションならtrue 00154 */ 00155 virtual bool isSceneNodeAnimation() const{ return true; } 00156 00157 //-------------------------------------------------------------------------- 00158 protected: 00159 /** 00160 * コンストラクタ 00161 * @param name 名前 00162 * @param manager アニメーションマネージャ 00163 */ 00164 SceneNodeAnimation(String name, AnimationManager* manager); 00165 00166 /** 00167 * デストラクタ 00168 */ 00169 virtual ~SceneNodeAnimation(); 00170 00171 private: 00172 // アニメーションデータ 00173 SceneNodeAnimationData* animationData_; 00174 // ターゲット 00175 SceneNode* target_; 00176 00177 }; 00178 00179 //------------------------------------------------------------------------------ 00180 } // End of namespace Lamp 00181 #endif // End of SCENE_NODE_ANIMATION_H_ 00182 //------------------------------------------------------------------------------ 00183