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_SCENE_NODE_INSTANCE_H_ 00026 #define TRANSLATION_SCENE_NODE_INSTANCE_H_ 00027 00028 #include "Translator/Instance/TranslationInstance.h" 00029 00030 namespace LampForMaya{ 00031 00032 //------------------------------------------------------------------------------ 00033 /** 00034 * 変換シーンノードインスタンス 00035 */ 00036 class TranslationSceneNodeInstance : public TranslationInstance{ 00037 friend class TranslationInstanceManager; 00038 public: 00039 /** 00040 * デストラクタ 00041 */ 00042 virtual ~TranslationSceneNodeInstance(); 00043 00044 //-------------------------------------------------------------------------- 00045 /** 00046 * 分析 00047 * @return 成功すればtrue 00048 */ 00049 virtual bool analyze(); 00050 00051 //-------------------------------------------------------------------------- 00052 /** 00053 * Lampへの変換 00054 * @param scene シーン 00055 * @return 成功すればtrue 00056 */ 00057 virtual bool convertToLamp(Scene* scene); 00058 00059 /** 00060 * アニメーションの変換 00061 * @param animationManager アニメーションマネージャ 00062 * @param animationSet アニメーションセット 00063 * @return 成功すればtrue 00064 */ 00065 virtual bool convertAnimation( 00066 AnimationManager* animationManager, AnimationSet* animationSet){ 00067 return convertSceneNodeAnimation( 00068 animationManager, animationSet, source_, destination_); 00069 } 00070 00071 //-------------------------------------------------------------------------- 00072 // RTTI 00073 //-------------------------------------------------------------------------- 00074 /** 00075 * 変換シーンノードインスタンスかどうか 00076 * @return 変換シーンノードインスタンスならtrue 00077 */ 00078 virtual bool isTranslationSceneNodeInstance() const{ return true; } 00079 00080 protected: 00081 //-------------------------------------------------------------------------- 00082 /** 00083 * コンストラクタ 00084 * @param initializePath 初期化するDagパス 00085 * @param initializeName 初期化する名前 00086 */ 00087 TranslationSceneNodeInstance( 00088 const MDagPath& initializePath, const String& initializeName); 00089 00090 /** 00091 * ゼロチェック 00092 * @param point チェックするポイント 00093 * @return ポイントが0ならtrueを返す 00094 */ 00095 virtual bool zeroCheck(const MPoint& point){ 00096 if( (Math::abs((float)point.x) > Math::epsilon) || 00097 (Math::abs((float)point.y) > Math::epsilon) || 00098 (Math::abs((float)point.z) > Math::epsilon)){ 00099 return false; 00100 } 00101 return true; 00102 } 00103 00104 /// コピー元 00105 SceneNode* source_; 00106 /// コピー先 00107 SceneNode* destination_; 00108 /// ピボット 00109 Vector3 pivot_; 00110 /// スケール 00111 Vector3 scale_; 00112 /// 回転 00113 Vector3 rotation_; 00114 /// 移動 00115 Vector3 translation_; 00116 00117 }; 00118 00119 //------------------------------------------------------------------------------ 00120 } // End of namespace LampForMaya 00121 #endif // End of TRANSLATION_SCENE_NODE_INSTANCE_H_ 00122 //------------------------------------------------------------------------------