13 #ifndef _FBXSDK_SCENE_GEOMETRY_MESH_H_
14 #define _FBXSDK_SCENE_GEOMETRY_MESH_H_
53 void BeginPolygon(
int pMaterial=-1,
int pTexture=-1,
int pGroup=-1,
bool pLegacy=
true);
61 void BeginPolygonExt(
int pMaterial,
int* pTextures);
67 void AddPolygon(
int pIndex,
int pTextureUVIndex = -1);
81 return ( pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() ) ? mPolygons[pPolygonIndex].mSize : -1;
89 int GetPolygonGroup(
int pPolygonIndex)
const;
98 if( pPolygonIndex >= 0 && pPolygonIndex<mPolygons.GetCount() ) mPolygons[pPolygonIndex].mGroup = pGroup;
107 return ( pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() && pPositionInPolygon >= 0 && pPositionInPolygon < mPolygons[pPolygonIndex].mSize ) ?
108 mPolygonVertices[mPolygons[pPolygonIndex].mIndex + pPositionInPolygon] : -1;
117 bool GetPolygonVertexNormal(
int pPolyIndex,
int pVertexIndex,
FbxVector4& pNormal)
const;
135 bool GetPolygonVertexUV(
int pPolyIndex,
int pVertexIndex,
const char* pUVSetName,
FbxVector2& pUV,
bool& pUnmapped)
const;
154 int* GetPolygonVertices()
const;
179 int GetPolygonVertexIndex(
int pPolygonIndex)
const;
186 int RemovePolygon(
int pPolygonIndex);
223 int GetUVLayerCount()
const;
303 void SetTextureUVIndex(
int pPolygonIndex,
int pPositionInPolygon,
int pIndex,
FbxLayerElement::EType pTypeIdentifier);
318 bool GenerateNormals(
bool pOverwrite=
false,
bool pByCtrlPoint =
false,
bool pCW=
false);
323 bool CheckIfVertexNormalsCCW();
350 mTotalNormal(0, 0, 0),
361 bool CheckSamePointTwice()
const;
367 int RemoveBadPolygons();
390 void MergePointsForPolygonVerteNormals(
FbxArray<int> &pMergeList);
396 void BuildMeshEdgeArray();
400 int GetMeshEdgeCount()
const;
409 int GetMeshEdgeIndex(
int pStartVertexIndex,
int pEndVertexIndex,
bool& pReversed,
int pExistedEdgeCount=-1);
414 void BeginGetMeshEdgeIndexForPolygon();
419 void EndGetMeshEdgeIndexForPolygon();
427 int GetMeshEdgeIndexForPolygon(
int pPolygon,
int pPositionInPolygon);
433 void GetMeshEdgeVertices(
int pEdgeIndex,
int& pStartVertexIndex,
int& pEndVertexIndex)
const;
438 void BeginGetMeshEdgeVertices();
443 void EndGetMeshEdgeVertices();
447 void SetMeshEdgeCount(
int pEdgeCount);
455 if (pEdgeIndex >= 0 && pEdgeIndex < mEdgeArray.GetCount())
457 FBX_ASSERT(pValue >= 0 && pValue < mPolygonVertices.GetCount());
459 if (pValue < 0 || pValue >= mPolygonVertices.GetCount())
465 mEdgeArray[pEdgeIndex] = pValue;
477 int AddMeshEdgeIndex(
int pStartVertexIndex,
int pEndVertexIndex,
bool pCheckForDuplicates);
490 int SetMeshEdgeIndex(
int pEdgeIndex,
int pStartVertexIndex,
int pEndVertexIndex,
bool pCheckForDuplicates,
int pExistedEdgeCount=-1);
494 void BeginAddMeshEdgeIndex();
497 void EndAddMeshEdgeIndex();
503 int AddMeshEdgeIndexForPolygon(
int pPolygonIndex,
int pPositionInPolygon);
514 bool SetMeshEdgeIndex(
int pEdgeIndex,
int pPolygonIndex,
int pPositionInPolygon);
518 bool IsTriangleMesh()
const;
538 double GetEdgeCreaseInfo(
int pEdgeIndex);
548 double GetVertexCreaseInfo(
int pVertexIndex);
559 bool SetEdgeCreaseInfo(
int pEdgeIndex,
double pWeight);
570 bool SetVertexCreaseInfo(
int pVertexIndex,
double pWeight);
611 int GetMeshPreviewDivisionLevels()
const;
615 void SetMeshPreviewDivisionLevels(
int pPreviewDivisionLevels);
620 int GetMeshRenderDivisionLevels()
const;
624 void SetMeshRenderDivisionLevels(
int pRenderDivisionLevels);
628 bool GetDisplaySubdivisions()
const;
632 void SetDisplaySubdivisions(
bool pDisplySubdivisions);
636 EBoundaryRule GetBoundaryRule()
const;
641 void SetBoundaryRule(EBoundaryRule pBoundaryRule);
645 bool GetPreserveBorders()
const;
650 void SetPreserveBorders(
bool pPreserveBorders);
654 bool GetPreserveHardEdges()
const;
659 void SetPreserveHardEdges(
bool pPreserveHardEdges);
663 bool GetPropagateEdgeHardness()
const;
668 void SetPropagateEdgeHardness(
bool pPropagateEdgeHardness);
676 bool GetPolyHoleInfo(
int pFaceIndex);
687 bool SetPolyHoleInfo(
int pFaceIndex,
bool pIsHole);
707 bool GenerateTangentsData(
const char* pUVSetName=
NULL,
bool pOverwrite=
false,
bool pIgnoreTangentFlip =
false);
719 bool GenerateTangentsData(
int pUVSetLayerIndex,
bool pOverwrite=
false,
bool pIgnoreTangentFlip =
false);
731 bool GenerateTangentsDataForAllUVSets(
bool pOverwrite=
false,
bool pIgnoreTangentFlip=
false);
737 #ifndef DOXYGEN_SHOULD_SKIP_THIS
744 struct PolygonDef{
int mIndex;
int mSize;
int mGroup; };
753 int mOriginalControlPointsCount;
761 int GetDataCount(
int pIndex) {
return mOffsets[pIndex + 1] - mOffsets[pIndex]; }
762 int GetData(
int pIndex,
int pSubIndex) {
return mData[ mOffsets[pIndex] + pSubIndex ]; }
763 int GetComponentCount() {
return mOffsets.GetCount() - 1; }
765 void ComputeComponentMaps(ComponentMap& pEdgeToPolyMap, ComponentMap& pPolyToEdgeMap);
774 void FillWithControlPointInfo(
FbxMesh* pMesh);
775 bool FillWithAdjacencyInfo(
FbxMesh* pMesh,
int pNbControlPoints);
780 int GetCount(
int pControlPoint)
const;
781 int GetVertex(
int pControlPoint,
int pVertex)
const;
787 void ComputeControlPointToVerticesMap(ControlPointToVerticesMap& pMap);
791 bool ConformNormalsTo(
const FbxMesh* pMesh);
794 void Construct(
const FbxObject* pFrom)
override;
795 void Destruct(
bool pRecursive)
override;
796 void ContentClear()
override;
800 void RemoveUVIndex(
FbxLayerElementUV* pLayerElementUV,
int pPolygonIndex,
int pOffset);
802 bool GetBadPolyIndices(
FbxArray<int>& pArrayBadPolyIndices,
bool pCheckOne)
const;
804 struct SplitEdgeData {
int mOriginalEdge;
bool mIsNew; };
806 ESmoothness mSmoothness;
807 int mPreviewDivisionLevels;
808 int mRenderDivisionLevels;
810 bool mDisplaySubdivisions;
811 EBoundaryRule mBoundaryRule;
812 bool mPreserveBorders;
813 bool mPreserveHardEdges;
814 bool mPropagateEdgeHardness;
816 struct PolygonIndexDef {
int mPolygonIndex;
int mSubPolygonIndex; };
830 PolygonIndexDef* mV2PV;
841 struct EdgeLookupDef {
FbxArray<int> mPVFlags;
bool mValid; } mPVEndFlags;
844 int FindPolygonIndex(
int pEdgeIndex);
845 static int PolygonIndexCompare(
const void* p1,
const void* p2);
847 template<
class T>
bool GetPolygonVertexLayerElementIndex(
const FbxLayerElementTemplate<T>* pLayerElement,
int pPolyIndex,
int pVertexIndex,
int& pIndex)
const;
848 template<
class T>
bool GetPolygonVertexLayerElementValue(
const FbxLayerElementTemplate<T>* pLayerElement,
int pPolyIndex,
int pVertexIndex, T& pValue,
bool pAllowUnmapped)
const;
853 bool GenerateTangentsData(
FbxLayerElementUV* pUVSet,
int pLayerIndex,
bool pOverwrite=
false,
bool pIgnoreTangentFlip =
false);
857 void GenerateNormalsByCtrlPoint(
bool pCW);
859 int GetIndex(
int index,
int capacity)
const;
#define FBXSDK_OBJECT_DECLARE(Class, Parent)
Macro used to declare a new class derived from FbxObject.
FbxNodeAttribute::EType GetAttributeType() const override
Returns the node attribute type.
FBX SDK environment definition.
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.
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.
This allocator only frees the allocated memory when it is deleted.
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.
This class template holds a pair of objects.
Not active "smooth mesh preview".
This class implements an efficient set based on value comparison, which stores values.
EBoundaryRule
the boundary rule.
FbxVector4 mTotalNormal
Sum of all the normals found.
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.
Second mSecond
The second object in the pair.
A four double mathematic vector class.
bool SetMeshEdge(int pEdgeIndex, int pValue)
Sets element in edge array to specific value.
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.
First mFirst
The first object in the pair.
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.