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 TRANSLATION_INSTANCE_H_ 00026 #define TRANSLATION_INSTANCE_H_ 00027 00028 namespace Lamp{ 00029 class Scene; 00030 class SceneNode; 00031 class SceneLeaf; 00032 class AnimationManager; 00033 class AnimationSet; 00034 } 00035 00036 #include <Core/Container/ArrayList.h> 00037 00038 namespace LampForMaya{ 00039 00040 class TranslationSceneNodeInstance; 00041 class TranslationLightInstance; 00042 class TranslationModelInstance; 00043 00044 //------------------------------------------------------------------------------ 00045 /** 00046 * 変換インスタンス 00047 */ 00048 class TranslationInstance{ 00049 friend class TranslationInstanceManager; 00050 public: 00051 /** 00052 * デストラクタ 00053 */ 00054 virtual ~TranslationInstance(); 00055 00056 //-------------------------------------------------------------------------- 00057 /** 00058 * 分析 00059 * @return 成功すればtrue 00060 */ 00061 virtual bool analyze(){ return analyzeInstance(); } 00062 00063 //-------------------------------------------------------------------------- 00064 /** 00065 * Lampへの変換 00066 * @param scene シーン 00067 * @return 成功すればtrue 00068 */ 00069 virtual bool convertToLamp(Scene* scene) = 0; 00070 00071 /** 00072 * アニメーションの変換 00073 * @param animationManager アニメーションマネージャ 00074 * @param animationSet アニメーションセット 00075 * @return 成功すればtrue 00076 */ 00077 virtual bool convertAnimation( 00078 AnimationManager* animationManager, AnimationSet* animationSet) = 0; 00079 00080 //-------------------------------------------------------------------------- 00081 /** 00082 * 名前の取得 00083 * @return 名前 00084 */ 00085 virtual String getName() const{ return name_; } 00086 00087 //-------------------------------------------------------------------------- 00088 // RTTI 00089 //-------------------------------------------------------------------------- 00090 /** 00091 * 変換シーンノードインスタンスかどうか 00092 * @return 変換シーンノードインスタンスならtrue 00093 */ 00094 virtual bool isTranslationSceneNodeInstance() const{ return false; } 00095 00096 /** 00097 * 変換シーンノードインスタンスへのキャスト 00098 * @return 変換シーンノードインスタンス。型が違えばNULLを返す。 00099 */ 00100 virtual TranslationSceneNodeInstance* castTranslationSceneNodeInstance() const{ 00101 if(isTranslationSceneNodeInstance()){ 00102 return (TranslationSceneNodeInstance*)this; 00103 } 00104 return NULL; 00105 } 00106 00107 //-------------------------------------------------------------------------- 00108 /** 00109 * 変換ライトインスタンスかどうか 00110 * @return 変換ライトインスタンスならtrue 00111 */ 00112 virtual bool isTranslationLightInstance() const{ return false; } 00113 00114 /** 00115 * 変換ライトインスタンスへのキャスト 00116 * @return 変換ライトインスタンス。型が違えばNULLを返す。 00117 */ 00118 virtual TranslationLightInstance* castTranslationLightInstance() const{ 00119 if(isTranslationLightInstance()){ 00120 return (TranslationLightInstance*)this; 00121 } 00122 return NULL; 00123 } 00124 00125 //-------------------------------------------------------------------------- 00126 /** 00127 * 変換モデルインスタンスかどうか 00128 * @return 変換モデルインスタンスならtrue 00129 */ 00130 virtual bool isTranslationModelInstance() const{ return false; } 00131 00132 /** 00133 * 変換モデルインスタンスへのキャスト 00134 * @return 変換モデルインスタンス。型が違えばNULLを返す。 00135 */ 00136 virtual TranslationModelInstance* castTranslationModelInstance() const{ 00137 if(isTranslationModelInstance()){ 00138 return (TranslationModelInstance*)this; 00139 } 00140 return NULL; 00141 } 00142 00143 protected: 00144 //-------------------------------------------------------------------------- 00145 /** 00146 * コンストラクタ 00147 * @param initializePath 初期化するDagパス 00148 * @param initializeName 初期化する名前 00149 */ 00150 TranslationInstance( 00151 const MDagPath& initializePath, const String& initializeName); 00152 00153 /** 00154 * インスタンスの分析 00155 * @return 成功すればtrue 00156 */ 00157 virtual bool analyzeInstance(); 00158 00159 /** 00160 * シーンノードアニメーションの変換 00161 * @param animationManager アニメーションマネージャ 00162 * @param animationSet アニメーションセット 00163 * @param sourceSceneNode コピー元シーンノード 00164 * @param destinationSceneNode コピー先シーンノード 00165 */ 00166 virtual bool convertSceneNodeAnimation( 00167 AnimationManager* animationManager, AnimationSet* animationSet, 00168 SceneNode* sourceSceneNode, SceneNode* destinationSceneNode); 00169 00170 /** 00171 * シーンリーフアニメーションの変換 00172 * @param animationManager アニメーションマネージャ 00173 * @param animationSet アニメーションセット 00174 * @param sourceSceneLeaf コピー元シーンリーフ 00175 * @param destinationSceneLeaf コピー先シーンリーフ 00176 */ 00177 virtual bool convertSceneLeafAnimation( 00178 AnimationManager* animationManager, AnimationSet* animationSet, 00179 SceneLeaf* sourceSceneLeaf, SceneLeaf* destinationSceneLeaf); 00180 00181 /// Dagパス 00182 MDagPath dagPath_; 00183 /// オブジェクト 00184 MObject object_; 00185 /// 名前 00186 String name_; 00187 /// 親シーンノードの名前 00188 String parentSceneNodeName_; 00189 /// 表示フラグ 00190 bool visibility_; 00191 00192 private: 00193 // コピーコンストラクタの隠蔽 00194 TranslationInstance(const TranslationInstance& copy); 00195 00196 // 代入コピーの隠蔽 00197 void operator =(const TranslationInstance& copy); 00198 00199 00200 }; 00201 00202 //------------------------------------------------------------------------------ 00203 } // End of namespace LampForMaya 00204 #endif // End of TRANSLATION_INSTANCE_H_ 00205 //------------------------------------------------------------------------------ 00206