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

TranslationMesh.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  * 変換メッシュヘッダ
00022  * @author Junpee
00023  */
00024 
00025 #ifndef TRANSLATION_MESH_H_
00026 #define TRANSLATION_MESH_H_
00027 
00028 namespace Lamp{
00029     class Scene;
00030 }
00031 
00032 namespace LampForMaya{
00033 
00034 class TranslationRigidMesh;
00035 class TranslationCharacterMesh;
00036 
00037 //------------------------------------------------------------------------------
00038 /**
00039  * 変換メッシュ
00040  */
00041 class TranslationMesh{
00042 friend class TranslationMeshManager;
00043 public:
00044     /**
00045      * デストラクタ
00046      */
00047     virtual ~TranslationMesh();
00048 
00049     /**
00050      * Lampへの変換
00051      * @param scene シーン
00052      * @return 成功すればtrue
00053      */
00054     virtual bool convertToLamp(Scene* scene) = 0;
00055 
00056     /**
00057      * 名前の取得
00058      * @return 名前
00059      */
00060     virtual String getName() const{ return name_; }
00061 
00062     /**
00063      * ピボットのコンパイル
00064      * @param pivot ピボット位置
00065      */
00066     virtual void compilePivot(const Vector3& pivot){}
00067 
00068     /**
00069      * 論理チェック
00070      * @return 成功すればtrue
00071      */
00072     virtual bool logicalCheck() = 0;
00073 
00074     //--------------------------------------------------------------------------
00075     /**
00076      * マテリアル名の設定
00077      * @param materialName マテリアル名
00078      */
00079     virtual void setMaterialName(const String& materialName){
00080         materialName_ = materialName;
00081     }
00082 
00083     /**
00084      * 位置の追加
00085      * @param position 追加する位置
00086      */
00087     virtual void addPosition(const Vector3& position){
00088         positions_.add(position);
00089     }
00090 
00091     /**
00092      * 法線の追加
00093      * @param normal 追加する法泉
00094      */
00095     virtual void addNormal(const Vector3& normal){ normals_.add(normal); }
00096 
00097     /**
00098      * 色の追加
00099      * @param color 追加する色
00100      */
00101     virtual void addColor(const Color4f& color){ colors_.add(color); }
00102 
00103     /**
00104      * UVの追加
00105      * @param uv 追加するUV
00106      */
00107     virtual void addUV(const TexCoord2& uv){ uvs_.add(uv); }
00108 
00109     /**
00110      * UVセット数の設定
00111      * @param uvSetCount UVセット数
00112      */
00113     virtual void setUVSetCount(int uvSetCount){ uvSetCount_ = uvSetCount; }
00114 
00115     //--------------------------------------------------------------------------
00116     // RTTI
00117     //--------------------------------------------------------------------------
00118     /**
00119      * 剛体メッシュかどうか
00120      * @return 剛体メッシュならtrue
00121      */
00122     virtual bool isRigidMesh() const{ return false; }
00123 
00124     /**
00125      * 剛体メッシュへのキャスト
00126      * @return 剛体メッシュ。型が違えばNULLを返す。
00127      */
00128     virtual TranslationRigidMesh* castRigidMesh() const{
00129         if(isRigidMesh()){
00130             return (TranslationRigidMesh*)this;
00131         }
00132         return NULL;
00133     }
00134 
00135     //--------------------------------------------------------------------------
00136     /**
00137      * キャラクタメッシュかどうか
00138      * @return キャラクタメッシュならtrue
00139      */
00140     virtual bool isCharacterMesh() const{ return false; }
00141 
00142     /**
00143      * キャラクタメッシュへのキャスト
00144      * @return キャラクタメッシュ。型が違えばNULLを返す。
00145      */
00146     virtual TranslationCharacterMesh* castCharacterMesh() const{
00147         if(isCharacterMesh()){
00148             return (TranslationCharacterMesh*)this;
00149         }
00150         return NULL;
00151     }
00152 
00153     //--------------------------------------------------------------------------
00154 
00155 protected:
00156     /**
00157      * コンストラクタ
00158      * @param initializeName 初期化する名前
00159      */
00160     TranslationMesh(const String& initializeName);
00161 
00162     /**
00163      * 頂点論理チェック
00164      * @return 正常ならture
00165      */
00166     virtual bool vertexLogicalCheck();
00167 
00168     /// 名前
00169     String name_;
00170     /// マテリアル名
00171     String materialName_;
00172     /// 位置配列
00173     ArrayList<Vector3> positions_;
00174     /// 法線配列
00175     ArrayList<Vector3> normals_;
00176     /// 色配列
00177     ArrayList<Color4f> colors_;
00178     /// UV配列
00179     ArrayList<TexCoord2> uvs_;
00180     /// UVセット数
00181     int uvSetCount_;
00182 
00183 private:
00184     // コピーコンストラクタの隠蔽
00185     TranslationMesh(const TranslationMesh& copy);
00186 
00187     // 代入コピーの隠蔽
00188     void operator =(const TranslationMesh& copy);
00189 
00190 
00191 };
00192 
00193 //------------------------------------------------------------------------------
00194 } // End of namespace LampForMaya
00195 #endif // End of TRANSLATION_MESH_H_
00196 //------------------------------------------------------------------------------

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