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);
614 EBoundaryRule GetBoundaryRule()
const;
619 void SetBoundaryRule(EBoundaryRule pBoundaryRule);
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);
684 bool GenerateTangentsData(
const char* pUVSetName=
NULL,
bool pOverwrite=
false);
695 bool GenerateTangentsData(
int pUVSetLayerIndex,
bool pOverwrite=
false);
706 bool GenerateTangentsDataForAllUVSets(
bool pOverwrite=
false);
712 #ifndef DOXYGEN_SHOULD_SKIP_THIS
719 struct PolygonDef{
int mIndex;
int mSize;
int mGroup; };
728 int mOriginalControlPointsCount;
736 int GetDataCount(
int pIndex) {
return mOffsets[pIndex + 1] - mOffsets[pIndex]; }
737 int GetData(
int pIndex,
int pSubIndex) {
return mData[ mOffsets[pIndex] + pSubIndex ]; }
738 int GetComponentCount() {
return mOffsets.GetCount() - 1; }
740 void ComputeComponentMaps(ComponentMap& pEdgeToPolyMap, ComponentMap& pPolyToEdgeMap);
744 class ControlPointToVerticesMap
747 ControlPointToVerticesMap();
748 ~ControlPointToVerticesMap();
754 bool Init(
int pNbEntries);
763 void ComputeControlPointToVerticesMap(ControlPointToVerticesMap& pMap);
767 bool ConformNormalsTo(
const FbxMesh* pMesh);
771 virtual void Destruct(
bool pRecursive);
776 void RemoveUVIndex(
FbxLayerElementUV* pLayerElementUV,
int pPolygonIndex,
int pOffset);
778 bool GetBadPolyIndices(
FbxArray<int>& pArrayBadPolyIndices,
bool pCheckOne)
const;
780 struct SplitEdgeData {
int mOriginalEdge;
bool mIsNew; };
782 ESmoothness mSmoothness;
783 int mPreviewDivisionLevels;
784 int mRenderDivisionLevels;
786 bool mDisplaySubdivisions;
787 EBoundaryRule mBoundaryRule;
788 bool mPreserveBorders;
789 bool mPreserveHardEdges;
790 bool mPropagateEdgeHardness;
792 struct PolygonIndexDef {
int mPolygonIndex;
int mSubPolygonIndex; };
796 PolygonIndexDef* mV2PV;
807 struct EdgeLookupDef {
FbxArray<int> mPVFlags;
bool mValid; } mPVEndFlags;
810 int FindPolygonIndex(
int pEdgeIndex);
811 static int PolygonIndexCompare(
const void* p1,
const void* p2);
813 template<
class T>
bool GetPolygonVertexLayerElementIndex(
const FbxLayerElementTemplate<T>* pLayerElement,
int pPolyIndex,
int pVertexIndex,
int& pIndex)
const;
814 template<
class T>
bool GetPolygonVertexLayerElementValue(
const FbxLayerElementTemplate<T>* pLayerElement,
int pPolyIndex,
int pVertexIndex, T& pValue,
bool pAllowUnmapped)
const;
819 bool GenerateTangentsData(
FbxLayerElementUV* pUVSet,
int pLayerIndex,
bool pOverwrite=
false);
823 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 void Compact()
Compact the memory used by this object.
Both display cage and smooth mesh.
Internal structure used to keep the duplicate vertex information.
virtual void ContentClear()
Clears this object's content from memory.
FbxLayerElementArrayTemplate provides data array manipulation of the data buffer for FbxLayerElement...
virtual FbxObject & Copy(const FbxObject &pObject)
Copy an object content into this object.
int GetPolygonCount() const
Get the polygon count of this mesh.
Layer element for mapping UVs to a geometry.
int GetPolygonVertex(int pPolygonIndex, int pPositionInPolygon) const
Get a polygon vertex (i.e: an index to a control point).
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.
virtual FbxNodeAttribute::EType GetAttributeType() const
Returns the node attribute type.
void ReservePolygonVertexCount(int pCount)
Reserve memory in the polygon vertex array to hold the specified number of polygon vertices...
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.
virtual void Construct(const FbxObject *pFrom)
Optional constructor override, automatically called by default constructor.
int lEdgeIndex
The edge index.
int GetPolygonVertexCount() const
Gets the number of polygon vertices in the mesh.
void SetPolygonGroup(int pPolygonIndex, int pGroup) const
Assign the specified polygon a group ID.
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".
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.
virtual void Destruct(bool pRecursive)
Optional destructor override, automatically called by default destructor.
A two double mathematic vector class.
FbxVector2 lUV
The UV associated with this duplicate control point.
int GetPolygonSize(int pPolygonIndex) const
Get the number of polygon vertices in a polygon.
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.