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 BUILD_INDEXED_TRIANGLE_FILTER_H_ 00026 #define BUILD_INDEXED_TRIANGLE_FILTER_H_ 00027 00028 #include <Graphics/SceneFilter/SceneFilterInterface.h> 00029 00030 namespace Lamp{ 00031 00032 class MeshData; 00033 00034 //------------------------------------------------------------------------------ 00035 /** 00036 * インデックストライアングル構築フィルタ 00037 * 00038 * 書式は"BuildIndexedTriangle"<br> 00039 * インデックストライアングルを構築する。<br> 00040 */ 00041 class BuildIndexedTriangleFilter : public SceneFilterInterface{ 00042 friend class SceneFilter; 00043 public: 00044 /// 最大インデックス数 00045 static const int maxIndex = 65536; 00046 00047 protected: 00048 /** 00049 * コンストラクタ 00050 * @param scene フィルタをかけるシーン 00051 */ 00052 BuildIndexedTriangleFilter(Scene* scene); 00053 00054 /** 00055 * デストラクタ 00056 */ 00057 virtual ~BuildIndexedTriangleFilter(); 00058 00059 /** 00060 * フィルタ 00061 * @param command コマンド 00062 * @return 成功すればtrue 00063 */ 00064 virtual bool filter(const String& command); 00065 00066 /// シーンのフィルタ 00067 virtual bool filterScene(); 00068 00069 /// メッシュデータのフィルタ 00070 virtual bool filterMeshData(); 00071 00072 00073 /// メッシュデータのフィルタ 00074 virtual bool filterMeshData(MeshData* meshData); 00075 00076 //-------------------------------------------------------------------------- 00077 /// クリア 00078 virtual void clear(); 00079 00080 /// インデックストライアングルの構築 00081 virtual bool buildIndexedTriangle(); 00082 00083 /// すでに頂点が無いか探す 00084 virtual int findIndex(int source); 00085 00086 /// バッファのアロケート 00087 virtual void allocateBuffer(); 00088 00089 /// バッファの解放 00090 virtual void freeBuffer(); 00091 00092 //-------------------------------------------------------------------------- 00093 /// 頂点数元データ 00094 int sourceVertexCount_; 00095 /// 位置元データ 00096 const Vector3* sourcePosition_; 00097 /// 法線元データ 00098 const Vector3* sourceNormal_; 00099 /// 頂点カラー元データ 00100 const Color4c* sourceColor_; 00101 /// テクスチャ座標元データ 00102 const float* const* sourceTexCoord_; 00103 /// ボーンインデックス元データ 00104 const u_char* sourceBoneIndex_; 00105 /// ウェイト元データ 00106 const float* sourceWeight_; 00107 /// 頂点数 00108 int vertexCount_; 00109 /// テクスチャ座標セット数 00110 int texCoordSetCount_; 00111 /// テクスチャ座標タイプ配列 00112 const TexCoord::Type* texCoordTypeArray_; 00113 /// 頂点あたりボーン数 00114 int bonesPerVertex_; 00115 /// 頂点あたりウェイト数 00116 int weightsPerVertex_; 00117 /// 位置 00118 Vector3* positions_; 00119 /// 法線 00120 Vector3* normals_; 00121 /// 色 00122 Color4c* colors_; 00123 /// テクスチャ座標 00124 float* texCoords_[TexCoord::maxSetCount]; 00125 /// ボーンインデックス 00126 u_char* boneIndices_; 00127 /// ウェイト 00128 float* weights_; 00129 /// インデックス 00130 u_short* indices_; 00131 }; 00132 00133 //------------------------------------------------------------------------------ 00134 } // End of namespace Lamp 00135 #endif // End of BUILD_INDEXED_TRIANGLE_FILTER_H_ 00136 //------------------------------------------------------------------------------