Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

LampBasicMaterial.h

Go to the documentation of this file.
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_BASIC_MATERIAL_H_
00026 #define LAMP_BASIC_MATERIAL_H_
00027 
00028 #include <Material/System/LampMaterial.h>
00029 
00030 namespace LampForMaya{
00031 
00032 //------------------------------------------------------------------------------
00033 /**
00034  * Lamp基本マテリアル
00035  */
00036 class LampBasicMaterial : public LampMaterial{
00037 public:
00038     //--------------------------------------------------------------------------
00039     // 静的メソッド
00040     //--------------------------------------------------------------------------
00041     /**
00042      * 生成
00043      *
00044      * unloadPluginを行わないとメモリリークとして検出されます。
00045      * @return プラグインインスタンス
00046      */
00047     static void* creator(){ return new LampBasicMaterial(); }
00048 
00049     /**
00050      * 初期化
00051      * @return 成功すればMStatus::kSuccessを返す
00052      */
00053     static MStatus initialize();
00054 
00055     /// 型識別ID
00056     static const MTypeId id;
00057 
00058     //--------------------------------------------------------------------------
00059     // 生成、破棄
00060     //--------------------------------------------------------------------------
00061     /**
00062      * コンストラクタ
00063      */
00064     LampBasicMaterial();
00065 
00066     /**
00067      * デストラクタ
00068      */
00069     virtual ~LampBasicMaterial();
00070 
00071     /**
00072      * コンストラクタ前処理
00073      */
00074     virtual void postConstructor();
00075 
00076     //--------------------------------------------------------------------------
00077     // 描画
00078     //--------------------------------------------------------------------------
00079     /**
00080      * ソフトウェアレンダリング
00081      * @param plug プラグ
00082      * @param dataBlock データブロック
00083      */
00084     virtual MStatus compute(const MPlug& plug, MDataBlock& dataBlock);
00085 
00086     //--------------------------------------------------------------------------
00087     /**
00088      * 透明度を持つかどうか
00089      */
00090     virtual bool hasTransparency();
00091 
00092     /**
00093      * 頂点あたりいくつの法線を必要とするか
00094      */
00095     virtual int normalsPerVertex();
00096 
00097     /**
00098      * 頂点あたりいくつのカラーを必要とするか
00099      */
00100     virtual int colorsPerVertex();
00101 
00102     /**
00103      * 頂点あたりいくつのUVを必要とするか
00104      */
00105     virtual int texCoordsPerVertex();
00106 
00107     //--------------------------------------------------------------------------
00108     /**
00109      * 描画
00110      * @return 成功すればMStatus::kSuccessを返す
00111      */
00112     virtual MStatus glGeometry(
00113         const MDagPath& shapePath, int prim, u_int writable,
00114         int indexCount, const u_int* indexArray,
00115         int vertexCount, const int* vertexIDs, const float* vertexArray,
00116         int normalCount, const float** normalArrays,
00117         int colorCount, const float** colorArrays,
00118         int texCoordCount, const float** texCoordArrays);
00119 
00120     //--------------------------------------------------------------------------
00121     // アトリビュートアクセス
00122     //--------------------------------------------------------------------------
00123     /**
00124      * ベーステクスチャの取得
00125      * @return ベーステクスチャ
00126      */
00127     virtual MObject getBaseTexture() const;
00128 
00129     /**
00130      * ベーステクスチャ名の取得
00131      * @return ベーステクスチャ名
00132      */
00133     virtual String getBaseTextureName() const;
00134 
00135     /**
00136      * ベースUVインデックスの取得
00137      * @return ベースUVインデックス
00138      */
00139     virtual int getBaseUVIndex() const;
00140 
00141     //--------------------------------------------------------------------------
00142     /**
00143      * 光沢テクスチャの取得
00144      * @return 光沢テクスチャ
00145      */
00146     virtual MObject getGlossTexture() const;
00147 
00148     /**
00149      * 光沢テクスチャ名の取得
00150      * @return 光沢テクスチャ名
00151      */
00152     virtual String getGlossTextureName() const;
00153 
00154     /**
00155      * 光沢UVインデックスの取得
00156      * @return 光沢UVインデックス
00157      */
00158     virtual int getGlossUVIndex() const;
00159 
00160     //--------------------------------------------------------------------------
00161     /**
00162      * ライトテクスチャの取得
00163      * @return ライトテクスチャ
00164      */
00165     virtual MObject getLightTexture() const;
00166 
00167     /**
00168      * ライトテクスチャ名の取得
00169      * @return ライトテクスチャ名
00170      */
00171     virtual String getLightTextureName() const;
00172 
00173     /**
00174      * ライトUVインデックスの取得
00175      * @return ライトUVインデックス
00176      */
00177     virtual int getLightUVIndex() const;
00178 
00179     //--------------------------------------------------------------------------
00180     /**
00181      * 汚れテクスチャの取得
00182      * @return 汚れテクスチャ
00183      */
00184     virtual MObject getStainTexture() const;
00185 
00186     /**
00187      * 汚れテクスチャ名の取得
00188      * @return 汚れテクスチャ名
00189      */
00190     virtual String getStainTextureName() const;
00191 
00192     /**
00193      * 汚れUVインデックスの取得
00194      * @return 汚れUVインデックス
00195      */
00196     virtual int getStainUVIndex() const;
00197 
00198     //--------------------------------------------------------------------------
00199     /**
00200      * ディフューズカラーの取得
00201      * @return ディフューズカラー
00202      */
00203     virtual Color3f getDiffuseColor() const;
00204 
00205     //--------------------------------------------------------------------------
00206     /**
00207      * スペキュラカラーの取得
00208      * @return スペキュラカラー
00209      */
00210     virtual Color3f getSpecularColor() const;
00211 
00212     /**
00213      * スペキュラパワーーの取得
00214      * @return スペキュラパワー
00215      */
00216     virtual float getSpecularPower() const;
00217 
00218     /**
00219      * スペキュラが有効か
00220      * @return スペキュラが有効ならtrue
00221      */
00222     virtual bool isSpecularEnabled() const{
00223         return (getSpecularColor() != Color3f::black);
00224     }
00225 
00226     //--------------------------------------------------------------------------
00227     /**
00228      * アンビエントカラーの取得
00229      * @return アンビエントカラー
00230      */
00231     virtual Color3f getAmbientColor() const;
00232 
00233     //--------------------------------------------------------------------------
00234     /**
00235      * エミッシブカラーの取得
00236      * @return エミッシブカラー
00237      */
00238     virtual Color3f getEmissiveColor() const;
00239 
00240 };
00241 
00242 //------------------------------------------------------------------------------
00243 } // End of namespace LampForMaya
00244 #endif // End of LAMP_BASIC_MATERIAL_H_
00245 //------------------------------------------------------------------------------

Generated on Wed Mar 16 10:29:55 2005 for LampForMaya by doxygen 1.3.2