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_MATERIAL_H_ 00026 #define TRANSLATION_MATERIAL_H_ 00027 00028 namespace Lamp{ 00029 class Scene; 00030 class Material; 00031 } 00032 00033 namespace LampForMaya{ 00034 00035 class TranslationBasicMaterial; 00036 00037 //------------------------------------------------------------------------------ 00038 /** 00039 * 変換マテリアル 00040 */ 00041 class TranslationMaterial{ 00042 friend class TranslationMaterialManager; 00043 public: 00044 /** 00045 * デストラクタ 00046 */ 00047 virtual ~TranslationMaterial(); 00048 00049 /** 00050 * 分析 00051 * @return 成功すればtrue 00052 */ 00053 virtual bool analyze() = 0; 00054 00055 /** 00056 * Lampへの変換 00057 * @param scene シーン 00058 * @return 成功すればtrue 00059 */ 00060 virtual bool convertToLamp(Scene* scene) = 0; 00061 00062 //-------------------------------------------------------------------------- 00063 // RTTI 00064 //-------------------------------------------------------------------------- 00065 /** 00066 * 基本マテリアルかどうか 00067 * @return 基本マテリアルならtrue 00068 */ 00069 virtual bool isBasicMaterial() const{ return false; } 00070 00071 /** 00072 * 基本マテリアルへのキャスト 00073 * @return 基本マテリアル。型が違えばNULLを返す。 00074 */ 00075 virtual TranslationBasicMaterial* castBasicMaterial() const{ 00076 if(isBasicMaterial()){ 00077 return (TranslationBasicMaterial*)this; 00078 } 00079 return NULL; 00080 } 00081 00082 //-------------------------------------------------------------------------- 00083 00084 protected: 00085 /** 00086 * コンストラクタ 00087 * @param initializeObject 初期化するオブジェクト 00088 * @param initializeName 初期化する名前 00089 */ 00090 TranslationMaterial( 00091 const MObject& initializeObject, const String& initializeName); 00092 00093 /** 00094 * マテリアルの分析 00095 * @return 成功すればtrue 00096 */ 00097 virtual bool analyzeMaterial(); 00098 00099 /** 00100 * マテリアルのコンバート 00101 * @param material マテリアル 00102 * @return 成功すればtrue 00103 */ 00104 virtual bool convertMaterial(Material* material); 00105 00106 /// オブジェクト 00107 MObject object_; 00108 /// 名前 00109 String name_; 00110 /// ブレンドモード 00111 int blendMode_; 00112 /// アルファ 00113 float alpha_; 00114 /// ブレンドソース 00115 int blendSource_; 00116 /// ブレンドデスティネーション 00117 int blendDestination_; 00118 /// Z書き込み 00119 bool zWrite_; 00120 /// Zテスト 00121 bool zTestlag_; 00122 /// フォグオプション 00123 int fogOption_; 00124 /// ライトマスク 00125 u_int lightMask_; 00126 /// 優先度 00127 int priority_; 00128 00129 private: 00130 // コピーコンストラクタの隠蔽 00131 TranslationMaterial(const TranslationMaterial& copy); 00132 00133 // 代入コピーの隠蔽 00134 void operator =(const TranslationMaterial& copy); 00135 00136 00137 }; 00138 00139 //------------------------------------------------------------------------------ 00140 } // End of namespace LampForMaya 00141 #endif // End of TRANSLATION_MATERIAL_H_ 00142 //------------------------------------------------------------------------------ 00143