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 * Lampマテリアルヘッダ 00022 * @author Junpee 00023 */ 00024 00025 #ifndef LAMP_MATERIAL_H_ 00026 #define LAMP_MATERIAL_H_ 00027 00028 namespace LampForMaya{ 00029 00030 //------------------------------------------------------------------------------ 00031 /** 00032 * Lampマテリアル 00033 */ 00034 class LampMaterial : public MPxHwShaderNode{ 00035 public: 00036 //-------------------------------------------------------------------------- 00037 // 初期化、後始末 00038 //-------------------------------------------------------------------------- 00039 /** 00040 * コンストラクタ 00041 */ 00042 LampMaterial(); 00043 00044 /** 00045 * デストラクタ 00046 */ 00047 ~LampMaterial(); 00048 00049 /** 00050 * マテリアル初期化 00051 */ 00052 static void materialInitialize(); 00053 00054 //-------------------------------------------------------------------------- 00055 // 描画 00056 //-------------------------------------------------------------------------- 00057 /** 00058 * マテリアルのセットアップ 00059 */ 00060 void materialSetup(); 00061 00062 /** 00063 * ユーザインターフェースシェーダ 00064 * @param plug プラグ 00065 * @param dataBlock データブロック 00066 */ 00067 MStatus uiShader(const MPlug& plug, MDataBlock& dataBlock); 00068 00069 //-------------------------------------------------------------------------- 00070 // アトリビュートアクセサ 00071 //-------------------------------------------------------------------------- 00072 /** 00073 * ブレンドモードの取得 00074 * @return ブレンドモード 00075 */ 00076 virtual int getBlendMode() const; 00077 00078 /** 00079 * ブレンドが有効か 00080 * @return ブレンドが有効ならtrue 00081 */ 00082 virtual bool isBlendEnabled() const{ 00083 return (getBlendMode() != 0); 00084 } 00085 00086 /** 00087 * アルファの取得 00088 * @return アルファ 00089 */ 00090 virtual float getAlpha() const; 00091 00092 /** 00093 * ブレンドソースの取得 00094 * @return ブレンドソース 00095 */ 00096 virtual int getBlendSource() const; 00097 00098 /** 00099 * ブレンドデスティネーションの取得 00100 * @return ブレンドデスティネーション 00101 */ 00102 virtual int getBlendDestination() const; 00103 00104 /** 00105 * ユーザインターフェースカラーの取得 00106 * @return ユーザインターフェースカラー 00107 */ 00108 virtual Color3f getUIColor() const; 00109 00110 /** 00111 * Z書き込みの取得 00112 * @return Z書き込み 00113 */ 00114 virtual bool useZWrite() const; 00115 00116 /** 00117 * Zテストの取得 00118 * @return Zテスト 00119 */ 00120 virtual bool useZTest() const; 00121 00122 /** 00123 * フォグオプションの取得 00124 * @return フォグオプション 00125 */ 00126 virtual int getFogOption() const; 00127 00128 /** 00129 * ライトマスクの取得 00130 * @return ライトマスク 00131 */ 00132 virtual u_int getLightMask() const; 00133 00134 /** 00135 * 優先度の取得 00136 * @return 優先度 00137 */ 00138 virtual int getPriority() const; 00139 00140 protected: 00141 /// アルファテスト境界 00142 static const float alphaTestBorder_; 00143 00144 /// ブレンドテーブルサイズ 00145 static const int blendTableSize_ = 11; 00146 00147 /// ブレンドテーブル 00148 static const u_int blendTable_[blendTableSize_]; 00149 00150 private: 00151 // コピーコンストラクタの隠蔽 00152 LampMaterial(const LampMaterial& copy); 00153 00154 // 代入コピーの隠蔽 00155 void operator =(const LampMaterial& copy); 00156 00157 }; 00158 00159 //------------------------------------------------------------------------------ 00160 } // End of namespace LampForMaya 00161 #endif // End of LAMP_MATERIAL_H_ 00162 //------------------------------------------------------------------------------ 00163