FbxGeometryConverter Class Reference
 
 
 
FbxGeometryConverter Class Reference

This reference page is linked to from the following overview topics: FBX SDK 2014.


#include <fbxgeometryconverter.h>


Class Description

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.

Examples:

Normals/main.cxx, and ViewScene/SceneContext.cxx.

Definition at line 37 of file fbxgeometryconverter.h.

List of all members.

Public Member Functions

FbxNode MergeMeshes (FbxArray< FbxNode * > &pMeshNodes, const char *pNodeName, FbxScene *pScene)
  Merge multiple meshes to one mesh.

Triangulation Utilities

bool  Triangulate (FbxScene *pScene, bool pReplace, bool pLegacy=false)
  Triangulate all node attributes in the scene that can be triangulated.
FbxNodeAttribute Triangulate (FbxNodeAttribute *pNodeAttribute, bool pReplace, bool pLegacy=false)
  Triangulate a node attribute, if supported, and preserve the skins and shapes animation channels.
bool  ComputeGeometryControlPointsWeightedMapping (FbxGeometry *pSrcGeom, FbxGeometry *pDstGeom, FbxWeightedMapping *pSrcToDstWeightedMapping, bool pSwapUV=false)
  Compute a "vertex-correspondence" table that helps passing from source to destination geometry.
FBX_DEPRECATED FbxMesh TriangulateMesh (const FbxMesh *pMesh)
  Triangulate a basic mesh, without support for holes.
FBX_DEPRECATED FbxMesh TriangulateMeshAdvance (const FbxMesh *pMesh)
  Triangulate a mesh with support for simple holes in polygons.
FBX_DEPRECATED FbxMesh TriangulatePatch (const FbxPatch *pPatch)
  Triangulate a patch.
FBX_DEPRECATED FbxMesh TriangulateNurbs (const FbxNurbs *pNurbs)
  Triangulate a nurb.
FBX_DEPRECATED bool  TriangulateInPlace (FbxNode *pNode)
  Triangulate the default mesh, patch or nurb contained in a node and preserve the skins and shapes animation channels.

Geometry Conversion

FbxNurbs ConvertPatchToNurbs (FbxPatch *pPatch)
  Convert from patch to nurb.
bool  ConvertPatchToNurbsInPlace (FbxNode *pNode)
  Convert a patch contained in a node to a nurb.
FbxNurbsSurface ConvertPatchToNurbsSurface (FbxPatch *pPatch)
  Convert a patch to nurb surface.
bool  ConvertPatchToNurbsSurfaceInPlace (FbxNode *pNode)
  Convert a patch contained in a node to a nurb surface.
FbxNurbsSurface ConvertNurbsToNurbsSurface (FbxNurbs *pNurbs)
  Convert a FbxNurbs to a FbxNurbsSurface.
FbxNurbs ConvertNurbsSurfaceToNurbs (FbxNurbsSurface *pNurbs)
  Convert a FbxNurbsSurface to a FbxNurbs.
bool  ConvertNurbsToNurbsSurfaceInPlace (FbxNode *pNode)
  Convert a nurb, contained in a node, to a nurbs surface.
bool  ConvertNurbsSurfaceToNurbsInPlace (FbxNode *pNode)
  Convert a nurb contained in a node to a nurbs surface.

Nurb UV and Links Swapping

FbxNurbs FlipNurbs (FbxNurbs *pNurbs, bool pSwapUV, bool pSwapClusters)
  Flip UV and/or skin clusters of a nurb.
FbxNurbsSurface FlipNurbsSurface (FbxNurbsSurface *pNurbs, bool pSwapUV, bool pSwapClusters)
  Flip UV and/or skin clusters of a nurb surface.

Normals By Polygon Vertex Emulation

bool  EmulateNormalsByPolygonVertex (FbxMesh *pMesh)
  Emulate normals by polygon vertex mode for a mesh.
bool  ComputeEdgeSmoothingFromNormals (FbxMesh *pMesh) const
  Create edge smoothing information from polygon-vertex mapped normals.
bool  ComputePolygonSmoothingFromEdgeSmoothing (FbxMesh *pMesh, int pIndex=0) const
  Convert edge smoothing to polygon smoothing group.
bool  ComputeEdgeSmoothingFromPolygonSmoothing (FbxMesh *pMesh, int pIndex=0) const
  Convert polygon smoothing group to edge smoothing.

Split Mesh Per Materials

bool  SplitMeshesPerMaterial (FbxScene *pScene, bool pReplace)
  Split all the mesh in the scene per material.
bool  SplitMeshPerMaterial (FbxMesh *pMesh, bool pReplace)
  Split mesh per material.

Member Function Documentation

bool Triangulate ( FbxScene pScene,
bool  pReplace,
bool  pLegacy = false 
)

Triangulate all node attributes in the scene that can be triangulated.

Parameters:
pScene The scene to iterate through to triangulate meshes.
pReplace If true, replace the original meshes with the new triangulated meshes on all the nodes, and delete the original meshes. Otherwise, original meshes are left untouched.
pLegacy If true, use legacy triangulation method that does not support holes in geometry. Provided for backward compatibility.
Returns:
true if all node attributes that can be triangulated were triangulated successfully.
Remarks:
The function will still iterate through all meshes regardless if one fails to triangulate, but will return false in that case. This function currently only supports node attribute of type eMesh, ePatch, eNurbs or eNurbsSurface.
FbxNodeAttribute* Triangulate ( FbxNodeAttribute pNodeAttribute,
bool  pReplace,
bool  pLegacy = false 
)

Triangulate a node attribute, if supported, and preserve the skins and shapes animation channels.

Parameters:
pNodeAttribute Pointer to the node containing the geometry to triangulate.
pReplace If true, replace the original mesh with the new triangulated mesh on the nodes, and delete the original mesh. Otherwise, original mesh is left untouched and only return new mesh.
pLegacy If true, use legacy triangulation method that does not support holes in geometry. Provided for backward compatibility.
Returns:
The newly created node attribute if successful, otherwise NULL. If node attribute type is not supported by triangulation, it returns the original node attribute.
Remarks:
This function currently only supports node attribute of type eMesh, ePatch, eNurbs or eNurbsSurface. If the node attribute does not support triangulation, or if it is already triangulated, this function will return pNodeAttribute.
bool ComputeGeometryControlPointsWeightedMapping ( FbxGeometry pSrcGeom,
FbxGeometry pDstGeom,
FbxWeightedMapping pSrcToDstWeightedMapping,
bool  pSwapUV = false 
)

Compute a "vertex-correspondence" table that helps passing from source to destination geometry.

Parameters:
pSrcGeom Pointer to the source geometry.
pDstGeom Pointer to the destination geometry.
pSrcToDstWeightedMapping Pointer to the weighted mapping table.
pSwapUV Set to true to swap UVs.
Returns:
true on success, false if the function fails to compute the correspondence.
Remarks:
Skins and shapes are also converted to fit the alternate geometry.
FBX_DEPRECATED FbxMesh* TriangulateMesh ( const FbxMesh pMesh )

Triangulate a basic mesh, without support for holes.

Parameters:
pMesh Pointer to the mesh to triangulate.
Returns:
Pointer to the new triangulated mesh.
Remarks:
This method creates a new mesh, leaving the source mesh unchanged. This function is deprecated, please use Triangulate instead.
FBX_DEPRECATED FbxMesh* TriangulateMeshAdvance ( const FbxMesh pMesh )

Triangulate a mesh with support for simple holes in polygons.

Parameters:
pMesh Pointer to the mesh to triangulate.
Returns:
Pointer to the new triangulated mesh if successful, otherwise NULL.
Remarks:
This method creates a new mesh, leaving the source mesh unchanged. This function is deprecated, please use Triangulate instead.
FBX_DEPRECATED FbxMesh* TriangulatePatch ( const FbxPatch pPatch )

Triangulate a patch.

Parameters:
pPatchPointer to the patch to triangulate.
Returns:
Pointer to the new triangulated mesh.
Remarks:
The current deformations (skins & shapes) on the patch are also converted and applied to the resulting mesh. This function is deprecated, please use Triangulate instead.
FBX_DEPRECATED FbxMesh* TriangulateNurbs ( const FbxNurbs pNurbs )

Triangulate a nurb.

Parameters:
pNurbs Pointer to the nurb to triangulate.
Returns:
Pointer to the new triangulated mesh.
Remarks:
The current deformations (skins and shapes) on the nurb are also converted and applied to the resulting mesh. This function is deprecated, please use Triangulate instead.
FBX_DEPRECATED bool TriangulateInPlace ( FbxNode pNode )

Triangulate the default mesh, patch or nurb contained in a node and preserve the skins and shapes animation channels.

Parameters:
pNode Pointer to the node containing the geometry to triangulate.
Returns:
true on success, or false if the node attribute is not a mesh, a patch or a nurb.
Remarks:
This funciton will only triangulate the default node attribute found on the node. Also, see the remarks for functions TriangulateMesh(), TriangulatePatch() and TriangulateNurbs(). This function is deprecated, please consider using Triangulate instead.
FbxNurbs* ConvertPatchToNurbs ( FbxPatch pPatch )

Convert from patch to nurb.

Parameters:
pPatch Pointer to the patch to convert.
Returns:
Created nurb or NULL if the conversion fails.
Remarks:
The patch must be of type eBSpline, eBezier or eLinear.
bool ConvertPatchToNurbsInPlace ( FbxNode pNode )

Convert a patch contained in a node to a nurb.

Use this function to preserve the patch's skins and shapes animation channels.

Parameters:
pNode Pointer to the node containing the patch.
Returns:
true on success, false if the node attribute is not a patch.
Remarks:
The patch must be of type eBSpline, eBezier or eLinear.
FbxNurbsSurface* ConvertPatchToNurbsSurface ( FbxPatch pPatch )

Convert a patch to nurb surface.

Parameters:
pPatch Pointer to the patch to convert.
Returns:
Created nurb surface or NULL if conversion fails.
Remarks:
The patch must be of type eBSpline, eBezier or eLinear.
bool ConvertPatchToNurbsSurfaceInPlace ( FbxNode pNode )

Convert a patch contained in a node to a nurb surface.

Use this function to preserve the patch's skins and shapes animation channels.

Parameters:
pNode Pointer to the node containing the patch.
Returns:
true on success, false if the node attribute is not a patch.
Remarks:
The patch must be of type eBSpline, eBezier or eLinear.
FbxNurbsSurface* ConvertNurbsToNurbsSurface ( FbxNurbs pNurbs )

Convert a FbxNurbs to a FbxNurbsSurface.

Parameters:
pNurbs Pointer to the original nurb
Returns:
A FbxNurbsSurface that is equivalent to the original nurb.
FbxNurbs* ConvertNurbsSurfaceToNurbs ( FbxNurbsSurface pNurbs )

Convert a FbxNurbsSurface to a FbxNurbs.

Parameters:
pNurbs Pointer to the original nurbs surface
Returns:
A FbxNurbs that is equivalent to the original nurbs surface.
bool ConvertNurbsToNurbsSurfaceInPlace ( FbxNode pNode )

Convert a nurb, contained in a node, to a nurbs surface.

Use this function to preserve the nurb's skins and shapes animation channels.

Parameters:
pNode Pointer to the node containing the nurb.
Returns:
true on success, false otherwise
bool ConvertNurbsSurfaceToNurbsInPlace ( FbxNode pNode )

Convert a nurb contained in a node to a nurbs surface.

Use this function to preserve the nurb's skins and shapes animation channels.

Parameters:
pNode Pointer to the node containing the nurbs surface.
Returns:
true on success, false otherwise
FbxNurbs* FlipNurbs ( FbxNurbs pNurbs,
bool  pSwapUV,
bool  pSwapClusters 
)

Flip UV and/or skin clusters of a nurb.

Parameters:
pNurbs Pointer to the Source nurb.
pSwapUV Set to true to swap the UVs.
pSwapClusters Set to true to swap the control point indices of clusters.
Returns:
A flipped FbxNurbs, or NULL if the function fails.
FbxNurbsSurface* FlipNurbsSurface ( FbxNurbsSurface pNurbs,
bool  pSwapUV,
bool  pSwapClusters 
)

Flip UV and/or skin clusters of a nurb surface.

Parameters:
pNurbs Pointer to the Source nurb surface.
pSwapUV Set to true to swap the UVs.
pSwapClusters Set to true to swap the control point indices of clusters.
Returns:
A flipped FbxNurbsSurface, or NULL if the function fails.
bool EmulateNormalsByPolygonVertex ( FbxMesh pMesh )

Emulate normals by polygon vertex mode for a mesh.

Parameters:
pMesh Pointer to the mesh object.
Returns:
true on success, false if the number of normals in the mesh and in its associated shapes don't match the number of polygon vertices.
Remarks:
For applications that only supports normals by control points, this function duplicates control points to equal the number of polygon vertices. skins and shapes are also converted. As preconditions:
  1. polygons must have been created
  2. the number of normals in the mesh and in its associated shapes must match the number of polygon vertices.
bool ComputeEdgeSmoothingFromNormals ( FbxMesh pMesh ) const

Create edge smoothing information from polygon-vertex mapped normals.

Existing smoothing information is removed and edge data is created if none exists on the mesh.

Parameters:
pMesh The mesh used to generate edge smoothing.
Returns:
true on success, false otherwise.
Remarks:
The edge smoothing data is placed on Layer 0 of the mesh. Normals do not need to be on Layer 0, since the first layer with per polygon vertex normals is used.
bool ComputePolygonSmoothingFromEdgeSmoothing ( FbxMesh pMesh,
int  pIndex = 0 
) const

Convert edge smoothing to polygon smoothing group.

Existing smoothing information is replaced.

Parameters:
pMesh The mesh that contains the smoothing to be converted.
pIndex The index of the layer smoothing to be converted.
Returns:
true on success, false otherwise.
Remarks:
The smoothing group is bitwise. Each bit of the integer represents one smoothing group. Therefore, there is a maximum of 32 smoothing groups.
bool ComputeEdgeSmoothingFromPolygonSmoothing ( FbxMesh pMesh,
int  pIndex = 0 
) const

Convert polygon smoothing group to edge smoothing.

Existing smoothing information is replaced.

Parameters:
pMesh The mesh that contains the smoothing to be converted.
pIndex The index of the layer smoothing to be converted
Returns:
true on success, false otherwise.
bool SplitMeshesPerMaterial ( FbxScene pScene,
bool  pReplace 
)

Split all the mesh in the scene per material.

Parameters:
pScene The scene to iterate through to split meshes.
pReplace If true, replace the original mesh with new ones and delete the original meshes, but *only* if they got split into multiple meshes, otherwise they are left untouched.
Returns:
true if all splitable mesh were successfully split, false otherwise.
Remarks:
The function will still iterate through all meshes regardless if one fails to split, but will return false in that case.
bool SplitMeshPerMaterial ( FbxMesh pMesh,
bool  pReplace 
)

Split mesh per material.

Parameters:
pMesh The mesh that will be split if it has multiple materials assigned.
pReplace If true, replace the original mesh with new one and delete the original mesh, but *only* if they got split into multiple meshes, otherwise left untouched.
Returns:
true on success, false otherwise.
Remarks:
The function will fail if the mapped material is not per face (FbxLayerElement::eByPolygon) or if a material is multi-layered. It will create as many meshes as there are materials applied to it. If one mesh have some polygons with material A, some polygons with material B, and some polygons with NO material, 3 meshes distinct will be created. The newly created meshes will be automatically attached to the same FbxNode that holds the original FbxMesh. If the original mesh have tangents, they will be regenerated on the new meshes.
FbxNode* MergeMeshes ( FbxArray< FbxNode * > &  pMeshNodes,
const char *  pNodeName,
FbxScene pScene 
)

Merge multiple meshes to one mesh.

The method will merge: a) mesh vertex; b) mesh polygon; c) mesh edge; d) all mesh elements; only the layer 0 elements is merged. e) if there are skins for old mesh, merge these skins. The new skin clusters link to old skeletons.

Parameters:
pMeshNodes FBX nodes that hold multiple meshes. These meshes will be merged.
pNodeName Name of new mesh node.
pScene The scene that will contain the new mesh node.
Returns:
The new mesh node if merge successfully, otherwise NULL is returned.
Remarks:
This method creates a new mesh, leaving the source mesh unchanged. The transform of new mesh node is: translate (0, 0, 0), rotation (0, 0, 0), scale (1, 1, 1). For layer element material, normal, smoothing, UV set, vertex color, binormal, tangent and polygon group, if any mesh misses these element, the merge for this kind of element is skipped. For layer element crease, hole, visibility and user data, if any mesh has such element, the kind of element will be merged. The missing element will be filled with default values. For meshes with skin binding, if the pose of frame 0 is different with bind pose, the new mesh will be distorted.

The documentation for this class was generated from the following file: