Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013 #ifndef _FBXSDK_SCENE_GEOMETRY_MESH_H_
00014 #define _FBXSDK_SCENE_GEOMETRY_MESH_H_
00015
00016 #include <fbxsdk/fbxsdk_def.h>
00017
00018 #include <fbxsdk/core/base/fbxarray.h>
00019 #include <fbxsdk/scene/geometry/fbxgeometry.h>
00020
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022
00032 class FBXSDK_DLL FbxMesh : public FbxGeometry
00033 {
00034 FBXSDK_OBJECT_DECLARE(FbxMesh, FbxGeometry);
00035
00036 public:
00039 virtual FbxNodeAttribute::EType GetAttributeType() const;
00040
00052 void BeginPolygon(int pMaterial=-1, int pTexture=-1, int pGroup=-1, bool pLegacy=true);
00053
00060 void BeginPolygonExt(int pMaterial, int* pTextures);
00061
00066 void AddPolygon(int pIndex, int pTextureUVIndex = -1);
00067
00069 void EndPolygon();
00070
00073 inline int GetPolygonCount() const { return mPolygons.GetCount(); }
00074
00078 inline int GetPolygonSize(int pPolygonIndex) const
00079 {
00080 return ( pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() ) ? mPolygons[pPolygonIndex].mSize : -1;
00081 }
00082
00088 int GetPolygonGroup(int pPolygonIndex) const;
00089
00095 inline void SetPolygonGroup(int pPolygonIndex, int pGroup) const
00096 {
00097 if( pPolygonIndex >= 0 && pPolygonIndex<mPolygons.GetCount() ) mPolygons[pPolygonIndex].mGroup = pGroup;
00098 }
00099
00104 inline int GetPolygonVertex(int pPolygonIndex, int pPositionInPolygon) const
00105 {
00106 return ( pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() && pPositionInPolygon >= 0 && pPositionInPolygon < mPolygons[pPolygonIndex].mSize ) ?
00107 mPolygonVertices[mPolygons[pPolygonIndex].mIndex + pPositionInPolygon] : -1;
00108 }
00109
00116 bool GetPolygonVertexNormal(int pPolyIndex, int pVertexIndex, FbxVector4& pNormal) const;
00117
00121 bool GetPolygonVertexNormals(FbxArray<FbxVector4>& pNormals) const;
00122
00134 bool GetPolygonVertexUV(int pPolyIndex, int pVertexIndex, const char* pUVSetName, FbxVector2& pUV, bool& pUnmapped) const;
00135
00147 bool GetPolygonVertexUVs(const char* pUVSetName, FbxArray<FbxVector2>& pUVs, FbxArray<int>* pUnmappedUVId = NULL) const;
00148
00153 int* GetPolygonVertices() const;
00154
00159 inline int GetPolygonVertexCount() const { return mPolygonVertices.Size(); }
00160
00178 int GetPolygonVertexIndex(int pPolygonIndex) const;
00179
00185 int RemovePolygon(int pPolygonIndex);
00186
00192 int RemoveDuplicatedEdges(FbxArray<int>& pEdgeIndexList);
00194
00206 void InitTextureUV(int pCount, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse);
00207
00214 void AddTextureUV(FbxVector2 pUV, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse);
00215
00218 int GetTextureUVCount(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse);
00219
00222 int GetUVLayerCount() const;
00223
00232 FbxArray<FbxLayerElement::EType> GetAllChannelUV(int pLayer);
00234
00252 void InitMaterialIndices(FbxLayerElement::EMappingMode pMappingMode);
00253
00265 void InitTextureIndices(FbxLayerElement::EMappingMode pMappingMode, FbxLayerElement::EType pTextureType);
00266
00281 void InitTextureUVIndices(FbxLayerElement::EMappingMode pMappingMode, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse);
00282
00292 int GetTextureUVIndex(int pPolygonIndex, int pPositionInPolygon, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse);
00293
00302 void SetTextureUVIndex(int pPolygonIndex, int pPositionInPolygon, int pIndex, FbxLayerElement::EType pTypeIdentifier);
00304
00309 void Reset();
00310
00314 void ComputeVertexNormals(bool pCW=false);
00315
00319 bool CheckIfVertexNormalsCCW();
00320
00322 class DuplicateVertex
00323 {
00324 public:
00325 DuplicateVertex() :
00326 lVertexPolyIndex(0),
00327 lNewVertexIndex(0),
00328 lNormal(0, 0, 0),
00329 lUV(0, 0),
00330 lEdgeIndex(0)
00331 {
00332 }
00333
00334 int lVertexPolyIndex;
00335 int lNewVertexIndex;
00336 FbxVector4 lNormal;
00337 FbxVector2 lUV;
00338 int lEdgeIndex;
00339 };
00340
00342 class VertexNormalInfo
00343 {
00344 public:
00345 VertexNormalInfo() :
00346 mTotalNormal(0, 0, 0),
00347 mNumNormal(0)
00348 {
00349 }
00350
00351 FbxVector4 mTotalNormal;
00352 int mNumNormal;
00353 };
00354
00357 bool CheckSamePointTwice() const;
00358
00363 int RemoveBadPolygons();
00365
00372 bool SplitPoints(FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse);
00373
00377 bool BuildMergeList(FbxArray<int>& pMergeList, bool pExport=false);
00378
00381 void MergePointsForPolygonVerteNormals(FbxArray<int> &pMergeList);
00383
00386
00387
00391
00400
00405
00410
00418
00424
00429
00434
00438
00443
00452
00465
00469
00472
00478
00489
00493
00495
00498
00502
00513
00518
00523
00528
00534
00539
00545
00550
00552
00558
00567
00577
00582
00586
00590
00595
00599
00603
00607
00611
00616
00620
00625
00629
00634
00638
00643
00645
00651
00656
00662
00667
00669
00681
00692
00703
00705
00709
00786