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 TEXT_ANIMATION_LOADER_H_ 00026 #define TEXT_ANIMATION_LOADER_H_ 00027 00028 namespace Lamp{ 00029 00030 class TextReader; 00031 class StreamTokenizer; 00032 class AnimationManager; 00033 class VectorInterpolator; 00034 class RotationInterpolator; 00035 00036 //------------------------------------------------------------------------------ 00037 /** 00038 * テキストアニメーションローダ 00039 */ 00040 class TextAnimationLoader{ 00041 public: 00042 /** 00043 * コンストラクタ 00044 */ 00045 TextAnimationLoader(); 00046 00047 /** 00048 * デストラクタ 00049 */ 00050 virtual ~TextAnimationLoader(); 00051 00052 /** 00053 * ロード 00054 * @param filePath ファイルパス 00055 * @param manager ロード先アニメーションマネージャ 00056 */ 00057 virtual void load(const String& filePath, AnimationManager* manager); 00058 00059 /** 00060 * ロード 00061 * @param textReader テキストリーダ 00062 * @param manager ロード先アニメーションマネージャ 00063 */ 00064 virtual void load(TextReader* textReader, AnimationManager* manager); 00065 00066 protected: 00067 /** 00068 * ヘッダの読み込み 00069 */ 00070 virtual void readHeader(); 00071 00072 //-------------------------------------------------------------------------- 00073 // アニメーションセット 00074 //-------------------------------------------------------------------------- 00075 /** 00076 * アニメーションセットリストの読み込み 00077 */ 00078 virtual void readAnimationSetList(); 00079 00080 /** 00081 * アニメーションセットの読み込み 00082 * @param name 名前 00083 */ 00084 virtual void readAnimationSet(const String& name); 00085 00086 //-------------------------------------------------------------------------- 00087 // カメラ 00088 //-------------------------------------------------------------------------- 00089 /** 00090 * カメラアニメーションの読み込み 00091 * @param name 名前 00092 */ 00093 virtual void readCameraAnimation(const String& name); 00094 00095 /** 00096 * カメラアニメーションデータの読み込み 00097 * @param name 名前 00098 */ 00099 virtual void readCameraAnimationData(const String& name); 00100 00101 //-------------------------------------------------------------------------- 00102 // シーンノード 00103 //-------------------------------------------------------------------------- 00104 /** 00105 * シーンノードアニメーションの読み込み 00106 * @param name 名前 00107 */ 00108 virtual void readSceneNodeAnimation(const String& name); 00109 00110 /** 00111 * シーンノードアニメーションデータの読み込み 00112 * @param name 名前 00113 */ 00114 virtual void readSceneNodeAnimationData(const String& name); 00115 00116 //-------------------------------------------------------------------------- 00117 // モデル 00118 //-------------------------------------------------------------------------- 00119 /** 00120 * キャラクタモデルアニメーションの読み込み 00121 * @param name 名前 00122 */ 00123 virtual void readCharacterModelAnimation(const String& name); 00124 00125 /** 00126 * キャラクタモデルアニメーションデータの読み込み 00127 * @param name 名前 00128 */ 00129 virtual void readCharacterModelAnimationData(const String& name); 00130 00131 //-------------------------------------------------------------------------- 00132 // アニメーションセットリンク 00133 //-------------------------------------------------------------------------- 00134 /** 00135 * アニメーションセットリンクリストの読み込み 00136 */ 00137 virtual void readAnimationSetLinkList(); 00138 00139 /** 00140 * アニメーションセットリンクの読み込み 00141 * @param name 名前 00142 */ 00143 virtual void readAnimationSetLink(const String& name); 00144 00145 //-------------------------------------------------------------------------- 00146 // カメラアニメーションリンク 00147 //-------------------------------------------------------------------------- 00148 /** 00149 * カメラアニメーションリンクリスト読み込み 00150 */ 00151 virtual void readCameraLinkList(); 00152 00153 //-------------------------------------------------------------------------- 00154 // シーンノードアニメーションリンク 00155 //-------------------------------------------------------------------------- 00156 /** 00157 * シーンノードアニメーションリンクリスト読み込み 00158 */ 00159 virtual void readSceneNodeLinkList(); 00160 00161 //-------------------------------------------------------------------------- 00162 // キャラクタモデルアニメーションリンク 00163 //-------------------------------------------------------------------------- 00164 /** 00165 * キャラクタモデルアニメーションリンクリスト読み込み 00166 */ 00167 virtual void readCharacterModelLinkList(); 00168 00169 //-------------------------------------------------------------------------- 00170 // 値の読み込み 00171 //-------------------------------------------------------------------------- 00172 /** 00173 * bool値の読み込み 00174 * @return bool値 00175 */ 00176 virtual bool readBool(); 00177 00178 /** 00179 * int値の読み込み 00180 * @return int値 00181 */ 00182 virtual int readInt(); 00183 00184 /** 00185 * float値の読み込み 00186 * @return float値 00187 */ 00188 virtual float readFloat(); 00189 00190 /** 00191 * Vector3値の読み込み 00192 * @return Vector3値 00193 */ 00194 virtual Vector3 readVector3(); 00195 00196 /** 00197 * Quaternion値の読み込み 00198 * @return Quaternion値 00199 */ 00200 virtual Quaternion readQuaternion(); 00201 00202 //-------------------------------------------------------------------------- 00203 // ベクトル補間の読み込み 00204 //-------------------------------------------------------------------------- 00205 /** 00206 * ベクトル補間の読み込み 00207 * @return ベクトル補間 00208 */ 00209 virtual VectorInterpolator* readVectorInterpolator(); 00210 00211 /** 00212 * ベクトル定数補間の読み込み 00213 * @return ベクトル定数補間 00214 */ 00215 virtual VectorInterpolator* readVectorConstantInterpolator(); 00216 00217 /** 00218 * ベクトル配列補間の読み込み 00219 * @return ベクトル配列補間 00220 */ 00221 virtual VectorInterpolator* readVectorArrayInterpolator(); 00222 00223 /** 00224 * ベクトル線形補間の読み込み 00225 * @return ベクトル線形補間 00226 */ 00227 virtual VectorInterpolator* readVectorLinearInterpolator(); 00228 00229 //-------------------------------------------------------------------------- 00230 // 回転補間の読み込み 00231 //-------------------------------------------------------------------------- 00232 /** 00233 * 回転補間の読み込み 00234 * @return 回転補間 00235 */ 00236 virtual RotationInterpolator* readRotationInterpolator(); 00237 00238 /** 00239 * 回転定数補間の読み込み 00240 * @return 回転定数補間 00241 */ 00242 virtual RotationInterpolator* readRotationConstantInterpolator(); 00243 00244 /** 00245 * オイラー回転配列補間の読み込み 00246 * @return オイラー回転配列補間 00247 */ 00248 virtual RotationInterpolator* readEulerArrayInterpolator(); 00249 00250 /** 00251 * 四元数回転配列補間の読み込み 00252 * @return 四元数回転配列補間 00253 */ 00254 virtual RotationInterpolator* readQuaternionArrayInterpolator(); 00255 00256 /** 00257 * 四元数回転線形補間の読み込み 00258 * @return 四元数回転線形補間 00259 */ 00260 virtual RotationInterpolator* readQuaternionLinearInterpolator(); 00261 00262 //-------------------------------------------------------------------------- 00263 // ユーティリティ 00264 //-------------------------------------------------------------------------- 00265 /** 00266 * トークンの読み込み 00267 * @param caller 呼び出し元 00268 */ 00269 virtual String readToken(const String& caller); 00270 00271 /** 00272 * 指定ワードの読み飛ばし 00273 * @param word 読み飛ばすワード 00274 */ 00275 virtual void skipWord(const String& word); 00276 00277 /** 00278 * チャンクを開く 00279 */ 00280 virtual void openChunk(){ skipWord("{"); } 00281 00282 /** 00283 * チャンクを閉じる 00284 */ 00285 virtual void closeChunk(){ skipWord("}"); } 00286 00287 //-------------------------------------------------------------------------- 00288 // メンバ 00289 //-------------------------------------------------------------------------- 00290 /// トークナイザ 00291 StreamTokenizer* tokenizer_; 00292 /// アニメーションマネージャ 00293 AnimationManager* manager_; 00294 00295 private: 00296 // コピーコンストラクタの隠蔽 00297 TextAnimationLoader(const TextAnimationLoader& copy); 00298 00299 // 代入コピーの隠蔽 00300 void operator =(const TextAnimationLoader& copy); 00301 00302 }; 00303 00304 //------------------------------------------------------------------------------ 00305 } // End of namespace Lamp 00306 #endif // End of TEXT_ANIMATION_LOADER_H_ 00307 //------------------------------------------------------------------------------