13 #ifndef _FBXSDK_SCENE_GEOMETRY_MESH_H_ 14 #define _FBXSDK_SCENE_GEOMETRY_MESH_H_ 52 void BeginPolygon(
int pMaterial=-1,
int pTexture=-1,
int pGroup=-1,
bool pLegacy=
true);
60 void BeginPolygonExt(
int pMaterial,
int* pTextures);
66 void AddPolygon(
int pIndex,
int pTextureUVIndex = -1);
80 return ( pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() ) ? mPolygons[pPolygonIndex].mSize : -1;
88 int GetPolygonGroup(
int pPolygonIndex)
const;
97 if( pPolygonIndex >= 0 && pPolygonIndex<mPolygons.GetCount() ) mPolygons[pPolygonIndex].mGroup = pGroup;
106 return ( pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() && pPositionInPolygon >= 0 && pPositionInPolygon < mPolygons[pPolygonIndex].mSize ) ?
107 mPolygonVertices[mPolygons[pPolygonIndex].mIndex + pPositionInPolygon] : -1;
116 bool GetPolygonVertexNormal(
int pPolyIndex,
int pVertexIndex,
FbxVector4& pNormal)
const;
134 bool GetPolygonVertexUV(
int pPolyIndex,
int pVertexIndex,
const char* pUVSetName,
FbxVector2& pUV,
bool& pUnmapped)
const;
153 int* GetPolygonVertices()
const;
178 int GetPolygonVertexIndex(
int pPolygonIndex)
const;
185 int RemovePolygon(
int pPolygonIndex);
222 int GetUVLayerCount()
const;
302 void SetTextureUVIndex(
int pPolygonIndex,
int pPositionInPolygon,
int pIndex,
FbxLayerElement::EType pTypeIdentifier);
317 bool GenerateNormals(
bool pOverwrite=
false,
bool pByCtrlPoint =
false,
bool pCW=
false);
322 bool CheckIfVertexNormalsCCW();
349 mTotalNormal(0, 0, 0),
360 bool CheckSamePointTwice()
const;
366 int RemoveBadPolygons();
380 bool BuildMergeList(
FbxArray<int>& pMergeList,
bool pExport=
false);
384 void MergePointsForPolygonVerteNormals(
FbxArray<int> &pMergeList);
390 void BuildMeshEdgeArray();
394 int GetMeshEdgeCount()
const;
403 int GetMeshEdgeIndex(
int pStartVertexIndex,
int pEndVertexIndex,
bool& pReversed,
int pExistedEdgeCount=-1);
408 void BeginGetMeshEdgeIndexForPolygon();
413 void EndGetMeshEdgeIndexForPolygon();
421 int GetMeshEdgeIndexForPolygon(
int pPolygon,
int pPositionInPolygon);
427 void GetMeshEdgeVertices(
int pEdgeIndex,
int& pStartVertexIndex,
int& pEndVertexIndex)
const;
432 void BeginGetMeshEdgeVertices();
437 void EndGetMeshEdgeVertices();
441 void SetMeshEdgeCount(
int pEdgeCount);
446 inline void SetMeshEdge(
int pEdgeIndex,
int pValue){
if( pEdgeIndex >= 0 && pEdgeIndex < mEdgeArray.GetCount() ) mEdgeArray[pEdgeIndex] = pValue; }
455 int AddMeshEdgeIndex(
int pStartVertexIndex,
int pEndVertexIndex,
bool pCheckForDuplicates);
468 int SetMeshEdgeIndex(
int pEdgeIndex,
int pStartVertexIndex,
int pEndVertexIndex,
bool pCheckForDuplicates,
int pExistedEdgeCount=-1);
472 void BeginAddMeshEdgeIndex();
475 void EndAddMeshEdgeIndex();
481 int AddMeshEdgeIndexForPolygon(
int pPolygonIndex,
int pPositionInPolygon);
492 bool SetMeshEdgeIndex(
int pEdgeIndex,
int pPolygonIndex,
int pPositionInPolygon);
496 bool IsTriangleMesh()
const;
516 double GetEdgeCreaseInfo(
int pEdgeIndex);
526 double GetVertexCreaseInfo(
int pVertexIndex);
537 bool SetEdgeCreaseInfo(
int pEdgeIndex,
double pWeight);
548 bool SetVertexCreaseInfo(
int pVertexIndex,
double pWeight);
589 int GetMeshPreviewDivisionLevels()
const;
593 void SetMeshPreviewDivisionLevels(
int pPreviewDivisionLevels);
598 int GetMeshRenderDivisionLevels()
const;
602 void SetMeshRenderDivisionLevels(
int pRenderDivisionLevels);
606 bool GetDisplaySubdivisions()
const;
610 void SetDisplaySubdivisions(
bool pDisplySubdivisions);
623 bool GetPreserveBorders()
const;
628 void SetPreserveBorders(
bool pPreserveBorders);
632 bool GetPreserveHardEdges()
const;
637 void SetPreserveHardEdges(
bool pPreserveHardEdges);
641 bool GetPropagateEdgeHardness()
const;
646 void SetPropagateEdgeHardness(
bool pPropagateEdgeHardness);
654 bool GetPolyHoleInfo(
int pFaceIndex);
665 bool SetPolyHoleInfo(
int pFaceIndex,
bool pIsHole);
685 bool GenerateTangentsData(
const char* pUVSetName=
NULL,
bool pOverwrite=
false,
bool pIgnoreTangentFlip =
false);
697 bool GenerateTangentsData(
int pUVSetLayerIndex,
bool pOverwrite=
false,
bool pIgnoreTangentFlip =
false);
709 bool GenerateTangentsDataForAllUVSets(
bool pOverwrite=
false,
bool pIgnoreTangentFlip=
false);
715 #ifndef DOXYGEN_SHOULD_SKIP_THIS 717 virtual void Compact();
722 struct PolygonDef{
int mIndex;
int mSize;
int mGroup; };
731 int mOriginalControlPointsCount;
739 int GetDataCount(
int pIndex) {
return mOffsets[pIndex + 1] - mOffsets[pIndex]; }
740 int GetData(
int pIndex,
int pSubIndex) {
return mData[ mOffsets[pIndex] + pSubIndex ]; }
741 int GetComponentCount() {
return mOffsets.GetCount() - 1; }
743 void ComputeComponentMaps(ComponentMap& pEdgeToPolyMap, ComponentMap& pPolyToEdgeMap);
750 ControlPointToVerticesMap();
751 ~ControlPointToVerticesMap();
757 bool Init(
int pNbEntries);
766 void ComputeControlPointToVerticesMap(ControlPointToVerticesMap& pMap);
770 bool ConformNormalsTo(
const FbxMesh* pMesh);
773 virtual void Construct(
const FbxObject* pFrom);
774 virtual void Destruct(
bool pRecursive);
775 virtual void ContentClear();
779 void RemoveUVIndex(
FbxLayerElementUV* pLayerElementUV,
int pPolygonIndex,
int pOffset);
781 bool GetBadPolyIndices(
FbxArray<int>& pArrayBadPolyIndices,
bool pCheckOne)
const;
783 struct SplitEdgeData {
int mOriginalEdge;
bool mIsNew; };
786 int mPreviewDivisionLevels;
787 int mRenderDivisionLevels;
789 bool mDisplaySubdivisions;
791 bool mPreserveBorders;
792 bool mPreserveHardEdges;
793 bool mPropagateEdgeHardness;
795 struct PolygonIndexDef {
int mPolygonIndex;
int mSubPolygonIndex; };
799 PolygonIndexDef* mV2PV;
810 struct EdgeLookupDef {
FbxArray<int> mPVFlags;
bool mValid; } mPVEndFlags;
813 int FindPolygonIndex(
int pEdgeIndex);
814 static int PolygonIndexCompare(
const void* p1,
const void* p2);
816 template<
class T>
bool GetPolygonVertexLayerElementIndex(
const FbxLayerElementTemplate<T>* pLayerElement,
int pPolyIndex,
int pVertexIndex,
int& pIndex)
const;
817 template<
class T>
bool GetPolygonVertexLayerElementValue(
const FbxLayerElementTemplate<T>* pLayerElement,
int pPolyIndex,
int pVertexIndex, T& pValue,
bool pAllowUnmapped)
const;
822 bool GenerateTangentsData(
FbxLayerElementUV* pUVSet,
int pLayerIndex,
bool pOverwrite=
false,
bool pIgnoreTangentFlip =
false);
826 void GenerateNormalsByCtrlPoint(
bool pCW);
#define FBXSDK_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new class derived from FbxObject.
FBX SDK environment definition.
void SetMeshEdge(int pEdgeIndex, int pValue)
Sets element in edge array to specific value.
FbxLayer class provides a base for the layering mechanism.
virtual FbxNodeAttribute::EType GetAttributeType() const
Returns the node attribute type.
int GetPolygonVertexCount() const
Gets the number of polygon vertices in the mesh.
Both display cage and smooth mesh.
Internal structure used to keep the duplicate vertex information.
int GetPolygonVertex(int pPolygonIndex, int pPositionInPolygon) const
Get a polygon vertex (i.e: an index to a control point).
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
int GetPolygonSize(int pPolygonIndex) const
Get the number of polygon vertices in a polygon.
Layer element for mapping UVs to a geometry.
int lNewVertexIndex
The new index of the vertex.
EType
Node attribute types.
void ReservePolygonCount(int pCount)
Reserve memory in the polygon array to hold the specified number of polygons.
int mNumNormal
Number of normals added.
void ReservePolygonVertexCount(int pCount)
Reserve memory in the polygon vertex array to hold the specified number of polygon vertices...
void SetPolygonGroup(int pPolygonIndex, int pGroup) const
Assign the specified polygon a group ID.
This class complements the FbxLayerElement class.
The base class of most FBX objects.
EMappingMode
Determines how the element is mapped to a surface.
Not active "smooth mesh preview".
EBoundaryRule
the boundary rule.
FbxVector4 mTotalNormal
Sum of all the normals found.
int lEdgeIndex
The edge index.
FbxVector4 lNormal
The normal associated with this duplicate control point.
int lVertexPolyIndex
Index in mPolygonsVertex where the vertex is found.
Default value, not active "smooth mesh preview".
int GetPolygonCount() const
Get the polygon count of this mesh.
Layer element for mapping Textures to a geometry.
EType
Layer Element type identifier.
A four double mathematic vector class.
The base class of geometric objects that support control point deformations (e.g. ...
This class provides the functionality to convert geometry nodes attributes (FbxMesh, FbxNurbs and FbxPatch) and mainly focuses on the two major categories: Triangulation and conversion between NURBS and Patches surfaces.
A two double mathematic vector class.
FbxVector2 lUV
The UV associated with this duplicate control point.
Class for array of basic elements such as pointers and basic types.
Internal structure used to compute the normals on a mesh.
ESmoothness
Display Smoothness.
A mesh is a geometry made of polygons.