This reference page is linked to from the following overview topics: FBX SDK 2014, Geometry, Meshes, Materials and Textures, Supported Scene Elements, Customizing the FBX SDK, Feature-Oriented Programs, Nodes and the Scene Graph, Meshes, Using Python FBX with Eclipse, Instancing - Sharing a Mesh, FBX Objects, Materials, Differences between FBX SDK and Python FBX, Merging Two Scenes, Layered Textures, List of Python Fbx classes, FBX Node Attributes, Connections, FBX Nodes.

#include <fbxmesh.h>

Class Description

A mesh is a geometry made of polygons.

The class can define a geometry with as many n-sided polygons as needed. Users can freely mix triangles, quadrilaterals, and other polygons. Since the mesh-related terminology of the FBX SDK differs a little from the known standards, here are our definitions:

  • A control point is an XYZ coordinate, it is synonym of vertex.
  • A polygon vertex is an index to a control point (the same control point can be referenced by multiple polygon vertices).
  • A polygon is a group of polygon vertices. The minimum valid number of polygon vertices to define a polygon is 3.

FBX records in the background without lagging the game, using NVidia, AMD or Intel hardware acceleration. We built it to handle all major game titles and give outstanding performance, even on older low spec PCs. Whatever your set-up, you’re ready to get started with FBX Game Recorder. The Autodesk® FBX® SDK is a free, easy-to-use, C software development platform and API toolkit that allows application and content vendors to transfer existing content into. Download Autodesk FBX Converter. A comprehensive and practical application that provides you with the tools you need to convert, explore and preview FBX files in a simple manner. FBX records in the background without lagging the game, using NVidia, AMD or Intel hardware acceleration. We built it to handle all major game titles and give outstanding performance, even on older low spec PCs. Whatever your set-up, you’re ready to get started with FBX Game Recorder. And I found seems FBX SDK doesn't have a version on android currently, I wonder if Autodesk have plan to. Provide an android version of FBX SDK?(Or if you could provide FBX SDK source code I would be willing to port it to android) Q2. So for now I could choose to convert fbx to obj and load obj file on android, I wonder if 100%.

Methods to initialize, set and access control points are provided in the FbxGeometryBase class.

Examples:

Common/GeometryUtility.cxx, ExportDocument/main.cxx, ExportScene03/main.cxx, ExportScene03/MyKFbxMesh.h, ImportScene/DisplayCache.cxx, ImportScene/DisplayMesh.cxx, Instances/main.cxx, Layers/main.cxx, Normals/main.cxx, ProceduralTexture/main.cxx, SwitchBinding/main.cxx, UI_Examples/CubeCreator/SDK_Utility.cxx, UI_Examples/CubeCreator/SDK_Utility.h, UserProperties/main.cxx, UVSample/main.cxx, ViewScene/DrawScene.cxx, ViewScene/SceneCache.cxx, ViewScene/SceneCache.h, and ViewScene/SceneContext.cxx.

Definition at line 32 of file fbxmesh.h.

Classes

class DuplicateVertex
Internal structure used to keep the duplicate vertex information. More..
class VertexNormalInfo
Internal structure used to compute the normals on a mesh. More..

Public Member Functions

virtual FbxNodeAttribute::ETypeGetAttributeType () const
Return the type of node attribute.
void ReservePolygonCount (int pCount)
Reserve memory in the polygon array to hold the specified number of polygons.
void ReservePolygonVertexCount (int pCount)
Reserve memory in the polygon vertex array to hold the specified number of polygon vertices.
bool GetTextureUV (FbxLayerElementArrayTemplate< FbxVector2 > **pLockableArray, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse) const
bool GetMaterialIndices (FbxLayerElementArrayTemplate< int > **pLockableArray) const
bool GetTextureIndices (FbxLayerElementArrayTemplate< int > **pLockableArray, FbxLayerElement::EType pTextureType) const

Polygon Management

void BeginPolygon (int pMaterial=-1, int pTexture=-1, int pGroup=-1, bool pLegacy=true)
Begins the process of adding a polygon to the mesh.
void BeginPolygonExt (int pMaterial, int *pTextures)
Begin writing a polygon.
void AddPolygon (int pIndex, int pTextureUVIndex=-1)
Add a polygon vertex to the current polygon.
void EndPolygon ()
End writing a polygon, it should be called after adding one polygon.
int GetPolygonCount () const
Get the polygon count of this mesh.
int GetPolygonSize (int pPolygonIndex) const
Get the number of polygon vertices in a polygon.
int GetPolygonGroup (int pPolygonIndex) const
Get the current group ID of the specified polygon.
void SetPolygonGroup (int pPolygonIndex, int pGroup) const
Assign the specified polygon a group ID.
int GetPolygonVertex (int pPolygonIndex, int pPositionInPolygon) const
Get a polygon vertex (i.e: an index to a control point).
bool GetPolygonVertexNormal (int pPolyIndex, int pVertexIndex, FbxVector4 &pNormal) const
Get the normal associated with the specified polygon vertex.
bool GetPolygonVertexNormals (FbxArray< FbxVector4 > &pNormals) const
Get the normals associated with the mesh for every polygon vertex.
bool GetPolygonVertexUV (int pPolyIndex, int pVertexIndex, const char *pUVSetName, FbxVector2 &pUV, bool &pUnmapped) const
Get the UV associated with the specified polygon vertex.
bool GetPolygonVertexUVs (const char *pUVSetName, FbxArray< FbxVector2 > &pUVs, FbxArray< int > *pUnmappedUVId=NULL) const
Get the UVs associated with the mesh for every polygon vertex.
int * GetPolygonVertices () const
Get the array of polygon vertices (i.e: indices to the control points).
int GetPolygonVertexCount () const
Gets the number of polygon vertices in the mesh.
int GetPolygonVertexIndex (int pPolygonIndex) const
Gets the start index into the array returned by GetPolygonVertices() for the given polygon.
int RemovePolygon (int pPolygonIndex)
Remove the specified polygon from the mesh.
int RemoveDuplicatedEdges (FbxArray< int > &pEdgeIndexList)
Remove the duplicated edges from the mesh.

Texture UV Utility Functions.

The methods found in this section are utility functions used to handle UV coordinates quickly.

Internally, they refer to FbxLayer and FbxLayerElementUV methods to do the job. Except for the GetAllChannelUV(int pLayer), all the methods are implicitly working on Layer 0. Use the FbxLayer methods to have access to the other layers.

void InitTextureUV (int pCount, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse)
Init texture UV coordinates.
void AddTextureUV (FbxVector2 pUV, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse)
Add texture UV coordinates.
int GetTextureUVCount (FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse)
Get the number of texture UV coordinates.
int GetUVLayerCount () const
Get the number of layer containing at least one channel UVMap.
FbxArray< FbxLayerElement::EType > GetAllChannelUV (int pLayer)
Fills an array describing, for the given layer, which texture channel have UVs associated to it.

Material, Texture and UV Indices Utility Functions.

The methods found in this section are utility functions used to handle Material, Texture and UV indices quickly.

Internally, they refer to FbxLayer and FbxLayerElementUV methods to do the job. These functions are only working on Layer 0. Use the FbxLayer methods directly to access other layers.

void InitMaterialIndices (FbxLayerElement::EMappingMode pMappingMode)
Initialize material indices.
void InitTextureIndices (FbxLayerElement::EMappingMode pMappingMode, FbxLayerElement::EType pTextureType)
Initialize texture indices.
void InitTextureUVIndices (FbxLayerElement::EMappingMode pMappingMode, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse)
Initialize texture UV indices.
int GetTextureUVIndex (int pPolygonIndex, int pPositionInPolygon, FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse)
Get a texture UV index associated with a polygon vertex (i.e: an index to a control point).
void SetTextureUVIndex (int pPolygonIndex, int pPositionInPolygon, int pIndex, FbxLayerElement::EType pTypeIdentifier)
Set a texture UV index associated with a polygon vertex (i.e: an index to a control point).

Utility functions

void Reset ()
Reset the mesh to default values.
bool GenerateNormals (bool pOverwrite=false, bool pByCtrlPoint=false, bool pCW=false)
Generate vertex normals on the mesh.
FBX_DEPRECATED void ComputeVertexNormals (bool pCW=false)
Compute the vertex normals on the mesh.
bool CheckIfVertexNormalsCCW ()
Compares the normals calculated by doing cross-products between the polygon vertex and by the ones stored in the normal array.
bool CheckSamePointTwice () const
Verify if the mesh has polygons that are defined on the same point more than once.
int RemoveBadPolygons ()
Remove bad polygons from a mesh.

Point Splitting/Merging utility functions

bool SplitPoints (FbxLayerElement::EType pTypeIdentifier=FbxLayerElement::eTextureDiffuse)
Split points.
bool BuildMergeList (FbxArray< int > &pMergeList, bool pExport=false)
Insert the new indexes of the object that have to be merged.
void MergePointsForPolygonVerteNormals (FbxArray< int > &pMergeList)
Merge the points specified in the list.

Edge management functions

void BuildMeshEdgeArray ()
Automatically generate edge data for the mesh.
int GetMeshEdgeCount () const
Query the number of edges defined on this mesh.
int GetMeshEdgeIndex (int pStartVertexIndex, int pEndVertexIndex, bool &pReversed, int pExistedEdgeCount=-1)
Get the index for the edge between the given vertices.
void BeginGetMeshEdgeIndexForPolygon ()
Use this method before calling GetMeshEdgeIndexForPolygon if making several calls to that method.
void EndGetMeshEdgeIndexForPolygon ()
Use this method after calling GetMeshEdgeIndexForPolygon if making several calls to that method.
int GetMeshEdgeIndexForPolygon (int pPolygon, int pPositionInPolygon)
Get the index for the specific edge of pPolygon.
void GetMeshEdgeVertices (int pEdgeIndex, int &pStartVertexIndex, int &pEndVertexIndex) const
Get the vertices for the given edge.
void BeginGetMeshEdgeVertices ()
Use this method before calling GetMeshEdgeVertices if making several calls to that method.
void EndGetMeshEdgeVertices ()
Use this method after calling GetMeshEdgeVertices if making several calls to that method.
void SetMeshEdgeCount (int pEdgeCount)
Presets the number edge data elements.
void SetMeshEdge (int pEdgeIndex, int pValue)
Sets element in edge array to specific value.
int AddMeshEdgeIndex (int pStartVertexIndex, int pEndVertexIndex, bool pCheckForDuplicates)
Add an edge with the given start/end points.
int SetMeshEdgeIndex (int pEdgeIndex, int pStartVertexIndex, int pEndVertexIndex, bool pCheckForDuplicates, int pExistedEdgeCount=-1)
Set the index for the edge with the given start/end points.
void BeginAddMeshEdgeIndex ()
Call this before calling AddMeshEdgeIndex or SetMeshEdgeIndex to increase performance.
void EndAddMeshEdgeIndex ()
After calling AddMeshEdgeIndex or SetMeshEdgeIndex, EndAddMeshEdgeIndex should be called.
int AddMeshEdgeIndexForPolygon (int pPolygonIndex, int pPositionInPolygon)
Adds an edge for the specified polygon, and edge number within the polygon.
bool SetMeshEdgeIndex (int pEdgeIndex, int pPolygonIndex, int pPositionInPolygon)
Sets the specified edge to the specified polygon's edge.
bool IsTriangleMesh () const
Determines if the mesh is composed entirely of triangles.

Crease utility functions

double GetEdgeCreaseInfo (int pEdgeIndex)
Get crease weight by edge index.
bool GetEdgeCreaseInfoArray (FbxLayerElementArrayTemplate< double > **pCreaseArray)
Get crease edge array.
double GetVertexCreaseInfo (int pVertexIndex)
Get crease weight by vertex index.
bool GetVertexCreaseInfoArray (FbxLayerElementArrayTemplate< double > **pCreaseArray)
Get vertex crease array.
bool SetEdgeCreaseInfo (int pEdgeIndex, double pWeight)
Set crease weight by edge index.
bool SetEdgeCreaseInfoArray (FbxArray< double > *pWeightArray)
Set crease weight data array.
bool SetVertexCreaseInfo (int pVertexIndex, double pWeight)
Set crease weight by vertex index.
bool SetVertexCreaseInfoArray (FbxArray< double > *pWeightArray)
Set crease weight data array.

Smooth mesh preview utility functions

enum ESmoothness { eHull, eRough, eMedium, eFine }
Display Smoothness. More..
enum EBoundaryRule { eLegacy, eCreaseAll, eCreaseEdge }
the boundary rule. More..
FbxMesh::ESmoothnessGetMeshSmoothness () const
Get display smoothness from mesh.
void SetMeshSmoothness (FbxMesh::ESmoothness pSmoothness)
Set the mesh display smoothness mode.
int GetMeshPreviewDivisionLevels () const
Get preview subdivision levels from mesh.
void SetMeshPreviewDivisionLevels (int pPreviewDivisionLevels)
Set mesh preview subdivision levels.
int GetMeshRenderDivisionLevels () const
Get render subdivision levels from mesh.
void SetMeshRenderDivisionLevels (int pRenderDivisionLevels)
Set mesh render subdivision levels.
bool GetDisplaySubdivisions () const
Query whether to display subdivisions isolines on mesh.
void SetDisplaySubdivisions (bool pDisplySubdivisions)
Set the DisplySubdivisions state.
EBoundaryRuleGetBoundaryRule () const
Get BoundaryRule from mesh.
void SetBoundaryRule (EBoundaryRule pBoundaryRule)
Set BoundaryRule for this mesh.
bool GetPreserveBorders () const
Query whether to preserve borders when preview smooth mesh is enabled.
void SetPreserveBorders (bool pPreserveBorders)
Set the state of the PreserveBorders flag.
bool GetPreserveHardEdges () const
Query whether to preserve hard edges when preview smooth mesh.
void SetPreserveHardEdges (bool pPreserveHardEdges)
Set the state of the PreserveHardEdges flag.
bool GetPropagateEdgeHardness () const
Query whether to PropagateEdgeHardness when preview smooth mesh.
void SetPropagateEdgeHardness (bool pPropagateEdgeHardness)
Set state of the PropagateEdgeHardness flag.

Geometry hole management utility functions

bool GetPolyHoleInfo (int pFaceIndex)
Get hole flag by face index (an index to a polygon).
bool GetPolyHoleInfoArray (FbxLayerElementArrayTemplate< bool > **pHoleArray)
Get hole flags Array.
bool SetPolyHoleInfo (int pFaceIndex, bool pIsHole)
Sets the flag indicating whether the face represents a hole or not.
bool SetPolyHoleInfoArray (FbxArray< bool > *pHoleArray)
Set hole flags array.

Tangents data management utility functions

bool GenerateTangentsData (const char *pUVSetName=NULL, bool pOverwrite=false)
Generate tangents data for UVSet with specific name.
bool GenerateTangentsData (int pUVSetLayerIndex, bool pOverwrite=false)
Generate tangents data for UVSet in specific layer.
bool GenerateTangentsDataForAllUVSets (bool pOverwrite=false)
Generate tangents data for all UVSets in all layers.

Member Enumeration Documentation

Display Smoothness.

It represents smooth mesh preview mode. This concept is not used in the FBX SDK but simply carried over so applications can access it and perform the appropriate tasks.

Enumerator:
eHull

Default value, not active 'smooth mesh preview'.

eRough

Not active 'smooth mesh preview'.

eMedium

Both display cage and smooth mesh.

eFine

Display smooth mesh.

Definition at line 567 of file fbxmesh.h.

the boundary rule.

Enumerator:
eLegacy

Default value.

eCreaseAll

Used for hard corner.

eCreaseEdge

Used for round corner.

Definition at line 576 of file fbxmesh.h.

Get started with editing and advance your skills with Media Composer First - free video editing software designed for aspiring editors, moviemakers, and hobbyists. Learn editing and become a better storyteller using the same tools the pros use. Download it now for free. /download-avid-media-composer.html.

Member Function Documentation

virtual FbxNodeAttribute::EType GetAttributeType()const [virtual]

Return the type of node attribute.

Returns:
Return the type of this node attribute which is EType::eMesh.

Reimplemented from FbxGeometry.

void BeginPolygon(int pMaterial = -1,
int pTexture = -1,
int pGroup = -1,
bool pLegacy = true
)

Begins the process of adding a polygon to the mesh.

Add vertexes to the polygon using AddPolygon. When the polygon is complete call EndPolygon to complete the creation of the polygon.

Parameters:
pMaterialIndex of material to assign to this polygon if material mapping type is eByPolygon. Otherwise it must be -1.
pTextureIndex of texture to assign to this polygon if texture mapping type is eByPolygon. Otherwise it must be -1.
pGroupGroup index assigned to polygon.
pLegacyWhen set to true, automatically create a LayerElement of type Texture; This was the default behavior of earlier versions of the FBX SDK. Since version 2010, the textures are connected to the material object.
Remarks:
This function must be called before AddPolygon().
If used, the pTexture index will reference textures assigned to the DIFFUSE channel (FbxLayerElement::eTextureDiffuse).
Examples:
Common/GeometryUtility.cxx, ExportDocument/main.cxx, ExportScene03/main.cxx, Instances/main.cxx, Layers/main.cxx, ProceduralTexture/main.cxx, UI_Examples/CubeCreator/SDK_Utility.cxx, and UserProperties/main.cxx.
void BeginPolygonExt(int pMaterial,
int * pTextures
)

Begin writing a polygon.

Add vertexes to the polygon using AddPolygon. When the polygon is complete call EndPolygon to complete the creation of the polygon.

Parameters:
pMaterialIndex of material to assign to this polygon if material mapping type is eByPolygon. Otherwise it must be -1.
pTexturesArray of index of texture (by texture type) to assign to this polygon if texture mapping type is eByPolygon. Otherwise it must be an array of -1. This array is expected to be of size: FbxLayerElement::sTypeTextureCount. If one texture type is not used, the corresponding entry must be left at -1.
void AddPolygon(int pIndex,
int pTextureUVIndex = -1
)

Add a polygon vertex to the current polygon.

Parameters:
pIndexIndex in the table of the control points.
pTextureUVIndexIndex of texture UV coordinates to assign to this polygon if texture UV mapping type is eByPolygonVertex. Otherwise it must be -1.
Remarks:
After adding all the polygons of the mesh, call function 'BuildMeshEdgeArray' to generate edge data for the mesh.
Examples:
Common/GeometryUtility.cxx, ExportDocument/main.cxx, ExportScene03/main.cxx, Instances/main.cxx, Layers/main.cxx, ProceduralTexture/main.cxx, UI_Examples/CubeCreator/SDK_Utility.cxx, and UserProperties/main.cxx.

End writing a polygon, it should be called after adding one polygon.

Examples:
Common/GeometryUtility.cxx, ExportDocument/main.cxx, ExportScene03/main.cxx, Instances/main.cxx, Layers/main.cxx, ProceduralTexture/main.cxx, UI_Examples/CubeCreator/SDK_Utility.cxx, and UserProperties/main.cxx.

Get the polygon count of this mesh.

Returns:
Return the number of polygons in the mesh.
Examples:
ExportDocument/main.cxx, ImportScene/DisplayCache.cxx, ImportScene/DisplayMesh.cxx, Normals/main.cxx, UVSample/main.cxx, ViewScene/DrawScene.cxx, and ViewScene/SceneCache.cxx.

Definition at line 73 of file fbxmesh.h.

int GetPolygonSize(int pPolygonIndex)const [inline]

Get the number of polygon vertices in a polygon.

Parameters:
pPolygonIndexIndex of the polygon.
Returns:
The number of polygon vertices in the indexed polygon. If the polygon index is out of bounds, return -1.
Examples:
ImportScene/DisplayCache.cxx, ImportScene/DisplayMesh.cxx, Normals/main.cxx, UVSample/main.cxx, and ViewScene/DrawScene.cxx.

Definition at line 78 of file fbxmesh.h.

Get the current group ID of the specified polygon.

A polygon group can be useful to identify a number of polygons that share the same properties. The FBX SDK does not use this information internally but guarantee its persistence in the FBX files and in memory.

Parameters:
pPolygonIndexIndex of the polygon.
Returns:
Group index assigned to the polygon. If the polygon index is out of bounds, return -1.
void SetPolygonGroup(int pPolygonIndex,
int pGroup
)const [inline]

Assign the specified polygon a group ID.

A polygon can only be assigned to one group at the time.

Parameters:
pPolygonIndexIndex of the polygon.
pGroupGroup index assigned to the polygon.
Returns:
Group index assigned to the polygon. If the polygon index is out of bounds, do nothing.

Definition at line 95 of file fbxmesh.h.

int GetPolygonVertex(int pPolygonIndex,
int pPositionInPolygon
)const [inline]

Get a polygon vertex (i.e: an index to a control point).

Parameters:
pPolygonIndexIndex of queried polygon. The valid range for this parameter is 0 to FbxMesh::GetPolygonCount().
pPositionInPolygonPosition of polygon vertex in indexed polygon. The valid range for this parameter is 0 to FbxMesh::GetPolygonSize(pPolygonIndex).
Returns:
Return the polygon vertex indexed or -1 if the requested vertex does not exists or the indices arguments have an invalid range.
Examples:
ImportScene/DisplayMesh.cxx, UVSample/main.cxx, ViewScene/DrawScene.cxx, and ViewScene/SceneCache.cxx.

Definition at line 104 of file fbxmesh.h.

bool GetPolygonVertexNormal(int pPolyIndex,
int pVertexIndex,
FbxVector4 & pNormal
)const

Get the normal associated with the specified polygon vertex.

Parameters:
pPolyIndexIndex of the polygon.
pVertexIndexIndex of the vertex in the polygon.
pNormalThe returned normal.
Returns:
True on success, false on failure.
Remarks:
pNormal remain unchanged if the requested vertex does not exists.
Examples:
ViewScene/SceneCache.cxx.
bool GetPolygonVertexNormals(FbxArray< FbxVector4 > & pNormals)const

Get the normals associated with the mesh for every polygon vertex.

Parameters:
pNormalsThe returned normals.
Returns:
True on success, false on failure.
bool GetPolygonVertexUV(int pPolyIndex,
int pVertexIndex,
const char * pUVSetName,
FbxVector2 & pUV,
bool & pUnmapped
)const

Get the UV associated with the specified polygon vertex.

Parameters:
pPolyIndexIndex of the polygon.
pVertexIndexIndex of the vertex in the polygon.
pUVSetNameThe name of the UV set that contains the UV.
pUVThe returned UV.
pUnmappedState flag that indicates if the polygon vertex does not have an associated UV.
Returns:
True on success, false on failure.
Remarks:
pUV remain unchanged if the requested vertex does not exists.
This function return true if the specified polygon vertex does not have an associated UV. In this case, pUnampped is set to true and the content of pUV is undefined.
Examples:
ViewScene/SceneCache.cxx.
bool GetPolygonVertexUVs(const char * pUVSetName,
FbxArray< FbxVector2 > & pUVs,
FbxArray< int > * pUnmappedUVId = NULL
)const

Get the UVs associated with the mesh for every polygon vertex.

Parameters:
pUVSetNameThe name of the UV set that contains the UVs.
pUVsThe returned UVs.
pUnmappedUVIdIf specified, this array will be filled with the indices of the UVs that are not associated to a polygon vertex and thus, have an undefined value. If the array as a size of 0, then all the polygon vertices have an associated UV coordinate and the pUVs array can be used as is. Otherwise, the calling application may be required to process the invalid UV coordinates to avoid inconsistent results. It is strongly suggested to use the FbxLayerElementUV's Direct and Indexed arrays directly (specially if the calling application supports indirection of the UVs).
Remarks:
unmapped UV coordinates are set to (0,0)
Returns:
True on success, false on failure.

Get the array of polygon vertices (i.e: indices to the control points).

This array is a concatenation of the list of polygon vertices of all the polygons. Example: a mesh made of 2 triangles with vertices [1,2,3] and vertices [2,3,4] results in [1,2,3,2,3,4]. The first polygon starts at position 0 and the second at position 3.

Returns:
The array of polygon vertices.

Gets the number of polygon vertices in the mesh.

Returns:
The overall size of the array of polygon vertices in the mesh.
Remarks:
This value can be smaller than the value returned by GetControlPointsCount() (meaning that not all of the control points stored in the object are used to define the mesh). However, typically it will be much bigger since any given control point can be used to define a vertex on multiple polygons.

Definition at line 159 of file fbxmesh.h.

Gets the start index into the array returned by GetPolygonVertices() for the given polygon.

This method can be used for a faster access to the polygon vertices indices. If, for example, we want to access the indices for polygon 3, the following code would do the trick

Parameters:
pPolygonIndexThe polygon of interest.
Returns:
The index into the GetPolygonVertices() array.
Remarks:
If the polygon index is out of bounds, return -1.

Remove the specified polygon from the mesh.

This method will automatically update the layers accordingly.

Parameters:
pPolygonIndexIndex of the polygon.
Returns:
Polygon index.
Remarks:
If the polygon index is out of bounds, return -1.
int RemoveDuplicatedEdges(FbxArray< int > & pEdgeIndexList)

Remove the duplicated edges from the mesh.

This method will remove duplicated edges. It will not change any vertex and not change the mesh topology.

Parameters:
pEdgeIndexListIndex list of edges.
Returns:
the count of removed edges.
Remarks:
the edge index list must be ordered. The last one is the max. If the edge index is out of bounds, return -1.
void InitTextureUV(int pCount,
FbxLayerElement::ETypepTypeIdentifier = FbxLayerElement::eTextureDiffuse
)

Init texture UV coordinates.

Parameters:
pCountNumber of texture UV elements.
pTypeIdentifierSpecifies which texture channel this UV refers to.
Remarks:
pCount must equal the number of control points of the Mesh if the UV mapping mode is FbxLayerElement::eByControlPoint.
void AddTextureUV(FbxVector2pUV,
FbxLayerElement::ETypepTypeIdentifier = FbxLayerElement::eTextureDiffuse
)

Add texture UV coordinates.

Appends a new element at the end of the array of texture UV coordinates.

Parameters:
pUVTexture UV coordinates, ranging between 0 and 1.
pTypeIdentifierSpecifies which texture channel this UV refers to.
Remarks:
The final number of texture UV elements must equal the number of control points if the UV mapping mode is FbxLayerElement::eByControlPoint.
int GetTextureUVCount(FbxLayerElement::ETypepTypeIdentifier = FbxLayerElement::eTextureDiffuse)

Get the number of texture UV coordinates.

Parameters:
pTypeIdentifierThe texture channel the UV refers to.

Get the number of layer containing at least one channel UVMap.

return 0 if no UV maps have been defined.

FbxArray<FbxLayerElement::EType> GetAllChannelUV(int pLayer)

Fills an array describing, for the given layer, which texture channel have UVs associated to it.

Parameters:
pLayerIndex of the layer.
Returns:
Array with the channel descriptor.
Remarks:
Only the channels that have UVs associated are reported in the array. For example, let's assume that we have defined UVs for the Diffuse, Ambient and Bump channels on layer 0. The resulting array will have the following three entries:
  • FbxLayerElement::eDIFFUSE_TEXTURE
  • FbxLayerElement::eAMBIENT_TEXTURE
  • FbxLayerElement::eBUMP_TEXTURE
void InitMaterialIndices(FbxLayerElement::EMappingModepMappingMode)

Initialize material indices.

Parameters:
pMappingModeThe mapping mode. This method must be called after FbxGeometryBase::InitControlPoints(). The material indices refer to the position of a material in the FbxLayerElementMaterial's direct array. See FbxLayerElementMaterial for more details. Supported mapping types are eByControlPoint, eByPolygon and eALL_SAME.
  • If mapping mode is eByControlPoint, there will be as many indices in the material index array as there are control points.
  • If mapping mode is eByPolygon, there will be as many indices in the material index array as there are polygons in the mesh.
  • If mapping mode is eALL_SAME, there will be only one index in the material index array.
Remarks:
This function will set the Reference mode of the FbxLayerElementMaterial on layer 0 to eIndexToDirect.
void InitTextureIndices(FbxLayerElement::EMappingModepMappingMode,
FbxLayerElement::ETypepTextureType
)

Initialize texture indices.

Parameters:
pMappingModeThe mapping mode. The texture indices refer to the texture connection to the material. In older versions of the FBX SDK, the indices were referring to the entries in the direct array of the FbxLayerElementTexture. See FbxLayerElementTexture for more details. Supported mapping modes are eByPolygon and eALL_SAME.
  • If mapping mode is eByPolygon, there will be as many indices in the texture index array as there are polygons in the mesh.
  • If mapping mode is eALL_SAME, there will be only one index in the texture index array.
pTextureTypeThe texture channel identifier.
Remarks:
This function will set the Reference mode of the FbxLayerElementTexture on layer 0 to eIndexToDirect.
void InitTextureUVIndices(FbxLayerElement::EMappingModepMappingMode,
FbxLayerElement::ETypepTypeIdentifier = FbxLayerElement::eTextureDiffuse
)

Initialize texture UV indices.

Parameters:
pMappingModeThe mapping mode. The texture UV indices refer to the index of an element in the FbxLayerElementUV's direct array. See FbxLayerElementUV for more details. Supported mapping types are eByControlPoint , eByPolygonVertex and eALL_SAME.
  • If mapping mode is eByControlPoint, there will be as many indices in the UV index array as there are control points. This will also set the Reference mode of the FbxLayerElementUV on layer 0 to eDirect.
  • If mapping mode is eByPolygonVertex, there will be an index in the UV index array for each vertex, for each polygon it is part of. This will also set the Reference mode of the FbxLayerElementUV on layer 0 to eIndexToDirect.
  • If mapping mode is eALL_SAME, there will be no index in the UV index array. This will also set the Reference mode of the FbxLayerElementUV on layer 0 to eDirect.
pTypeIdentifierThe texture channel the UVIndices refers to.
int GetTextureUVIndex(int pPolygonIndex,
int pPositionInPolygon,
FbxLayerElement::ETypepTypeIdentifier = FbxLayerElement::eTextureDiffuse
)

Get a texture UV index associated with a polygon vertex (i.e: an index to a control point).

Parameters:
pPolygonIndexIndex of polygon. The valid range for this parameter is 0 to FbxMesh::GetPolygonCount().
pPositionInPolygonPosition of polygon vertex in indexed polygon. The valid range for this parameter is 0 to FbxMesh::GetPolygonSize(pPolygonIndex).
pTypeIdentifierThe texture channel the UVIndex refers to.
Returns:
Return a texture UV index.
Remarks:
This function only works if the texture UV mapping mode is set to eByPolygonVertex, otherwise it returns -1.
Examples:
ImportScene/DisplayMesh.cxx.
void SetTextureUVIndex(int pPolygonIndex,
int pPositionInPolygon,
int pIndex,
FbxLayerElement::ETypepTypeIdentifier
)

Set a texture UV index associated with a polygon vertex (i.e: an index to a control point).

Parameters:
pPolygonIndexIndex of polygon. The valid range for this parameter is 0 to FbxMesh::GetPolygonCount().
pPositionInPolygonPosition of polygon vertex in indexed polygon. The valid range for this parameter is 0 to FbxMesh::GetPolygonSize(pPolygonIndex).
pIndexThe index of the texture UV we want to assign to the polygon vertex.
pTypeIdentifierThe texture channel the UVIndex refers to.
Remarks:
This function only works if the texture UV mapping type is set to eByPolygonVertex.

Reset the mesh to default values.

Frees and set to NULL all layers and clear the polygon and the control point array.

bool GenerateNormals(bool pOverwrite = false,
bool pByCtrlPoint = false,
bool pCW = false
)

Generate vertex normals on the mesh.

The normal computation takes into consideration, as much as possible, the smoothing groups.

Parameters:
pOverwriteIf true, re-generate normals data regardless of availability, otherwise left untouched if exist.
pByCtrlPointIf true, the recomputed normals will be defined by control points instead of by polygon vertex.
pCWTrue if the normals are calculated clockwise, false otherwise (counter-clockwise).
Returns:
true if successfully generated normals data, or if already available and pOverwrite is false.
FBX_DEPRECATED void ComputeVertexNormals(bool pCW = false)

Compute the vertex normals on the mesh.

The normals are per vertex and are the average of all the polygon normals associated with each vertex.

Parameters:
pCWTrue if the normals are calculated clockwise, false otherwise (counter-clockwise).
Remarks:
This function is deprecated. Please use GenerateNormals(true, true, pCW)

Compares the normals calculated by doing cross-products between the polygon vertex and by the ones stored in the normal array.

Returns:
false if ALL of them are Clockwise. Returns true otherwise.

Verify if the mesh has polygons that are defined on the same point more than once.

Returns:
true if the mesh has that kind of polygon, false otherwise.

Remove bad polygons from a mesh.

Degenerate polygons use a vertex more than once. Remove them from the mesh and from the layer element indices as needed.

Returns:
Number of polygons removed from the mesh, -1 if an error occurred.
bool SplitPoints(FbxLayerElement::ETypepTypeIdentifier = FbxLayerElement::eTextureDiffuse)

Split points.

Parameters:
pTypeIdentifierSpecify which UVs are processed.
Returns:
true if a split occurred, false otherwise.
Remarks:
This method replaces the BuildSplitList and SplitPointsForHardEdge.
bool BuildMergeList(FbxArray< int > & pMergeList,
bool pExport = false
)

Insert the new indexes of the object that have to be merged.

Parameters:
pMergeListThe list that will contain the indexes of the objects to merge.
pExportIf set to true, include the duplicate indexes in the merge list.
void MergePointsForPolygonVerteNormals(FbxArray< int > & pMergeList)

Merge the points specified in the list.

Parameters:
pMergeListList containing the information on the points that will be merged.

Automatically generate edge data for the mesh.

Clears all previously stored edge information

Query the number of edges defined on this mesh.

Returns:
The number of edges defined for this mesh
Examples:
ImportScene/DisplayMesh.cxx, and Normals/main.cxx.
int GetMeshEdgeIndex(int pStartVertexIndex,
int pEndVertexIndex,
bool & pReversed,
int pExistedEdgeCount = -1
)

Get the index for the edge between the given vertices.

Note that the result of this method is the same if pStartVertexIndex and pEndVertexIndex are swapped.

Parameters:
pStartVertexIndexThe starting point of the edge.
pEndVertexIndexThe ending point of the edge.
pReversedflag will be set to true if the reverse edge is found, false otherwise.
pExistedEdgeCountlegal edge count in mEdgeArray
Returns:
-1 if no edge exists for the given pair of vertices.

Use this method before calling GetMeshEdgeIndexForPolygon if making several calls to that method.

Once done calling GetMeshEdgeIndexForPolygon, call EndGetMeshEdgeIndex. This will optimize access time. Do not modify the mesh between calls to BeginGetMeshEdgeIndex and EndGetMeshEdgeIndex.

Use this method after calling GetMeshEdgeIndexForPolygon if making several calls to that method.

This will optimize access time. Do not modify the mesh between calls to BeginGetMeshEdgeIndex and EndGetMeshEdgeIndex.

int GetMeshEdgeIndexForPolygon(int pPolygon,
int pPositionInPolygon
)

Get the index for the specific edge of pPolygon.

Parameters:
pPolygonThe polygon of interest.
pPositionInPolygonThe specific edge number in the polygon.
Returns:
-1 if the specific edge does not exist.
Remarks:
To optimize access time when making several calls to this method, enclose these calls between the BeginGetMeshEdgeIndexForPolygon() and EndGetMeshEdgeIndexForPolygon() calls.
void GetMeshEdgeVertices(int pEdgeIndex,
int & pStartVertexIndex,
int & pEndVertexIndex
)const

Get the vertices for the given edge.

Note that the values returned are indices into the control point array.

Parameters:
pEdgeIndexThe edge to query.
pStartVertexIndexThe edge's starting point will be stored here.
pEndVertexIndexThe edge's starting point will be stored here.

Use this method before calling GetMeshEdgeVertices if making several calls to that method.

Once done calling GetMeshEdgeVertices, call EndGetMeshEdgeVertices. This will optimize access time. Do not modify the mesh between calls to BeginGetMeshEdgeVertices and EndGetMeshEdgeVertices.

Use this method after calling GetMeshEdgeVertices if making several calls to that method.

This will optimize access time. Do not modify the mesh between calls to BeginGetMeshEdgeVertices and EndGetMeshEdgeVertices.

Presets the number edge data elements.

Parameters:
pEdgeCountThe number of edges to allocate.
void SetMeshEdge(int pEdgeIndex,
int pValue
)[inline]

Sets element in edge array to specific value.

Parameters:
pEdgeIndexThe edge index
pValueThe edge data

Definition at line 452 of file fbxmesh.h.

int AddMeshEdgeIndex(int pStartVertexIndex,
int pEndVertexIndex,
bool pCheckForDuplicates
)

Add an edge with the given start/end points.

Note that the inserted edge may start at the given end point, and end at the given start point.

Parameters:
pStartVertexIndexThe starting point of the edge.
pEndVertexIndexThe ending point of the edge.
pCheckForDuplicatesSet to true to check if the mesh already contains an edge with these two points. Can be set to false to speed up this method, when the incoming edges are known to be consistent.
Returns:
Edge index of the new edge, or -1 on failure (edge/reverse edge already exists, no face using these 2 points consecutively )
int SetMeshEdgeIndex(int pEdgeIndex,
int pStartVertexIndex,
int pEndVertexIndex,
bool pCheckForDuplicates,
int pExistedEdgeCount = -1
)

Set the index for the edge with the given start/end points.

Note that the edge may start at the given end point, and end at the given start point.

Parameters:
pEdgeIndexThe edge index of the edge.
pStartVertexIndexThe starting point of the edge.
pEndVertexIndexThe ending point of the edge.
pCheckForDuplicatesSet to true to check if the mesh already contains an edge with these two points. Can be set to false to speed up this method, when the incoming edges are known to be consistent.
pExistedEdgeCountthe valid edge count that we have created in edge array. This parameter only works when pCheckForDuplicates is true. The default value is -1 which meaning current edge array has been fully filled with valid edges, i.e., we will search the full edge array for the duplicated edge.
Returns:
Edge index of the edge, or -1 on failure (no face using these 2 points consecutively ), or -2 if edge/reverse edge already exists

Call this before calling AddMeshEdgeIndex or SetMeshEdgeIndex to increase performance.

Once finished adding/setting edges EndAddMeshEdgeIndex should be called.

After calling AddMeshEdgeIndex or SetMeshEdgeIndex, EndAddMeshEdgeIndex should be called.

int AddMeshEdgeIndexForPolygon(int pPolygonIndex,
int pPositionInPolygon
)

Adds an edge for the specified polygon, and edge number within the polygon.

See SetMeshEdgeIndex for notes the the parameters.

Parameters:
pPolygonIndexThe polygon of interest.
pPositionInPolygonThe edge within the polygon
Returns:
edge index or -1 if failed.
bool SetMeshEdgeIndex(int pEdgeIndex,
int pPolygonIndex,
int pPositionInPolygon
)

Sets the specified edge to the specified polygon's edge.

Note that the position in the polygon ranges from 0 to GetPolygonSize(pPolygonindex) - 1 and represents the edge from GetPolygonVertex(pPolygonIndex, pPositionInPolygon) to GetPolygonVertex( pPolygonIndex, pPositionInPolygon + 1 ) or from pPositionInPolygon to 0 if pPositionInPolygon GetPolygonSize(pPolygonindex) - 1

Parameters:
pEdgeIndexThe edge.
pPolygonIndexThe polygon.
pPositionInPolygonThe specific edge number in the polygon.
Returns:
true on success, false on failure. ( edge for the poly and position already exists )

Determines if the mesh is composed entirely of triangles.

Returns:
true if all polygons are triangles, false otherwise

Reserve memory in the polygon array to hold the specified number of polygons.

Parameters:
pCountThe number of polygons this mesh will hold

Definition at line 507 of file fbxmesh.h.

void ReservePolygonVertexCount(int pCount)[inline]

Reserve memory in the polygon vertex array to hold the specified number of polygon vertices.

Parameters:
pCountThe number of polygon vertices

Definition at line 511 of file fbxmesh.h.

bool GetTextureUV(FbxLayerElementArrayTemplate< FbxVector2 > ** pLockableArray,
FbxLayerElement::ETypepTypeIdentifier = FbxLayerElement::eTextureDiffuse
)const
bool GetMaterialIndices(FbxLayerElementArrayTemplate< int > ** pLockableArray)const
bool GetTextureIndices(FbxLayerElementArrayTemplate< int > ** pLockableArray,
FbxLayerElement::ETypepTextureType
)const

Get crease weight by edge index.

Parameters:
pEdgeIndexEdge index.
Returns:
Crease weight value in the range [0.0 - 1.0].
bool GetEdgeCreaseInfoArray(FbxLayerElementArrayTemplate< double > ** pCreaseArray)

Get crease edge array.

Parameters:
pCreaseArrayEdge crease data array.
Returns:
true if the pCreaseArray is filled successfully.

Get crease weight by vertex index.

Parameters:
pVertexIndexVertex index.
Returns:
Crease weight value in the range [0.0 - 1.0].
bool GetVertexCreaseInfoArray(FbxLayerElementArrayTemplate< double > ** pCreaseArray)

Get vertex crease array.

Parameters:
pCreaseArrayEdge vertex data array.
Returns:
true if the pCreaseArray is filled successfully.
bool SetEdgeCreaseInfo(int pEdgeIndex,
double pWeight
)

Set crease weight by edge index.

Parameters:
pEdgeIndexEdge index.
pWeightCrease weight value in the range [0.0 - 1.0].
Returns:
true if successfully set the crease weight.
bool SetEdgeCreaseInfoArray(FbxArray< double > * pWeightArray)

Set crease weight data array.

Parameters:
pWeightArrayEdge crease data.
Returns:
true if successfully set the crease weight.
bool SetVertexCreaseInfo(int pVertexIndex,
double pWeight
)

Set crease weight by vertex index.

Parameters:
pVertexIndexVertex index.
pWeightCrease weight value in the range [0.0 - 1.0].
Returns:
true if successfully set the crease weight.
bool SetVertexCreaseInfoArray(FbxArray< double > * pWeightArray)

Set crease weight data array.

Parameters:
pWeightArrayVertex crease data.
Returns:
true if successfully set the crease weight.

Get display smoothness from mesh.

Returns:
Mesh smoothness.
Remarks:
It represents smooth mesh preview mode.
void SetMeshSmoothness(FbxMesh::ESmoothnesspSmoothness)

Set the mesh display smoothness mode.

Parameters:
pSmoothnessNew smoothness factor.
Remarks:
It represents smooth mesh preview mode.

Get preview subdivision levels from mesh.

Returns:
Mesh preview subdivision levels.
void SetMeshPreviewDivisionLevels(int pPreviewDivisionLevels)

Set mesh preview subdivision levels.

Parameters:
pPreviewDivisionLevelsNumber of subdivisions levels.

Get render subdivision levels from mesh.

Returns:
Mesh render subdivision levels
Remarks:
Sometimes, render division level can be the same as preview level.
void SetMeshRenderDivisionLevels(int pRenderDivisionLevels)

Set mesh render subdivision levels.

Parameters:
pRenderDivisionLevelsNumber of subdivision levels.

Query whether to display subdivisions isolines on mesh.

Returns:
The current state of the internal flag.
void SetDisplaySubdivisions(bool pDisplySubdivisions)

Set the DisplySubdivisions state.

Parameters:
pDisplySubdivisionsNew value for this flag.

Get BoundaryRule from mesh.

Returns:
Current value of the internal state.

Set BoundaryRule for this mesh.

Parameters:
pBoundaryRuleNew value for the internal state of this mesh.
Remarks:
BoundaryRule will affect the corners of smooth mesh.

Query whether to preserve borders when preview smooth mesh is enabled.

Returns:
The current state of the flag.

Set the state of the PreserveBorders flag.

Parameters:
pPreserveBordersNew value for this flag.
Remarks:
This flag value will affect smooth mesh preview results.

Query whether to preserve hard edges when preview smooth mesh.

Returns:
The current state of the flag.
void SetPreserveHardEdges(bool pPreserveHardEdges)

Set the state of the PreserveHardEdges flag.

Parameters:
pPreserveHardEdgesNew value for this flag.
Remarks:
This flag value will affect smooth mesh preview results.

Query whether to PropagateEdgeHardness when preview smooth mesh.

Returns:
The current state of the flag.
void SetPropagateEdgeHardness(bool pPropagateEdgeHardness)

Set state of the PropagateEdgeHardness flag.

Parameters:
pPropagateEdgeHardnessNew value for this flag.
Remarks:
This flag will affect smooth mesh preview results.

Get hole flag by face index (an index to a polygon).

Parameters:
pFaceIndexIndex of the queried polygon.
Returns:
The hole flag for the given face.
bool GetPolyHoleInfoArray(FbxLayerElementArrayTemplate< bool > ** pHoleArray)

Get hole flags Array.

Autodesk Fbx Sdk Download

Parameters:
pHoleArrayHole flags array.
Returns:
true if the pHoleArray is filled successfully.

Sets the flag indicating whether the face represents a hole or not.

Parameters:
pFaceIndexIndex of the processed polygon.
pIsHoleIf true, this face represent a hole.
Returns:
true if successfully set the hole info.
bool SetPolyHoleInfoArray(FbxArray< bool > * pHoleArray)

Set hole flags array.

Parameters:
pHoleArrayHole flag array.
Returns:
true if successfully set the hole flags.
bool GenerateTangentsData(const char * pUVSetName = NULL,
bool pOverwrite = false
)

Generate tangents data for UVSet with specific name.

Note that the UV winding order is stored in the W component of the tangent. W = 1.0 (right-handed) W = -1.0 (left-handed) In the case of a left-handed tangent, this function automatically flips the resulting binormal to correct for mirrored geometry.

Parameters:
pUVSetNameThe UVSet name to generate tangents data with. The UVSet on the first layer is the the default UVSet to generate.
pOverwriteIf true, re-generate tangents data regardless of availability, otherwise left untouched if exist.
Returns:
true if successfully generated tangents data, or if already available and pOverwrite is false.
bool GenerateTangentsData(int pUVSetLayerIndex,
bool pOverwrite = false
)

Generate tangents data for UVSet in specific layer.

Note that the UV winding order is stored in the W component of the tangent. W = 1.0 (right-handed) W = -1.0 (left-handed) In the case of a left-handed tangent, this function automatically flips the resulting binormal to correct for mirrored geometry.

Parameters:
pUVSetLayerIndexThe layer to generate tangents data with.
pOverwriteIf true, re-generate tangents data regardless of availability, otherwise left untouched if exist.
Returns:
true if successfully generated tangents data, or if already available and pOverwrite is false.
bool GenerateTangentsDataForAllUVSets(bool pOverwrite = false)

Generate tangents data for all UVSets in all layers.

Fbx Sdk 2019 Download

Note that the UV winding order is stored in the W component of the tangent: W = 1.0 (right-handed) W = -1.0 (left-handed) In the case of a left-handed tangent, this function automatically flips the resulting binormal to correct for mirrored geometry.

Parameters:
pOverwriteIf true, re-generate tangents data regardless of availability, otherwise left untouched if exist.
Returns:
true if successfully generated tangents data, or if already available and pOverwrite is false.
The documentation for this class was generated from the following file:
  • fbxsdk/scene/geometry/fbxmesh.h
Coments are closed
Scroll to top