This reference page is linked to from the following overview topics: Supported Scene Elements, Feature-Oriented Programs, Connections, Customizing the FBX SDK, Nodes and the Scene Graph, FBX Nodes, FBX Node Attributes, Geometry, Meshes, Materials and Textures, Meshes, Instancing - Sharing a Mesh, Materials, List of Python FBX classes.
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:
Methods to initialize, set and access control points are provided in the KFbxGeometryBase class.
Common/GeometryUtility.cxx, ExportDocument/main.cxx, ExportScene03/main.cxx, ExportScene03/MyKFbxMesh.cxx, ExportScene03/MyKFbxMesh.h, ImportScene/DisplayMesh.cxx, Instances/main.cxx, Layers/main.cxx, Normals/main.cxx, ProceduralTexture/main.cxx, SwitchBinding/main.cxx, UIExamples/CubeCreator/SDK_Utility.cxx, UIExamples/CubeCreator/SDK_Utility.h, UserProperties/main.cxx, UVSample/main.cxx, ViewScene/DrawScene.cxx, ViewScene/GlFunctions.cxx, and ViewScene/GlFunctions.h.
Definition at line 65 of file kfbxmesh.h.
#include <kfbxmesh.h>
Classes |
|
class | KDuplicateVertex |
Internal structure used to keep the
duplicate vertex information. More... |
|
struct | KFbxComponentMap |
Internal structure used to keep the mapping
information between edges and polygons. More... |
|
struct | KFbxEdgeLookup |
struct | KFbxPolygon |
struct | KFbxPolyIndex |
struct | KFbxSplitEdgeData |
struct | KFbxV2PVMap |
class | KVertexNormalInfo |
Internal structure used to compute the
normals on a mesh. More... |
|
Public Member Functions |
|
virtual EAttributeType | GetAttributeType () 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 (KFbxLayerElementArrayTemplate< KFbxVector2 > **pLockableArray, KFbxLayerElement::ELayerElementType pTypeIdentifier=KFbxLayerElement::eDIFFUSE_TEXTURES) const |
bool | GetMaterialIndices (KFbxLayerElementArrayTemplate< int > **pLockableArray) const |
bool | GetTextureIndices (KFbxLayerElementArrayTemplate< int > **pLockableArray, KFbxLayerElement::ELayerElementType pTextureType) const |
virtual KFbxObject & | Copy (const KFbxObject &pObject) |
Copy an object content into this object.
|
|
Public Attributes |
|
KArrayTemplate< KFbxPolygon > | mPolygons |
KArrayTemplate< int > | mPolygonVertices |
KArrayTemplate< int > | mEdgeArray |
Protected Member Functions |
|
void | InitTextureIndices (KFbxLayerElementTexture *pLayerElementTexture, KFbxLayerElement::EMappingMode pMappingMode) |
void | RemoveTextureIndex (KFbxLayerElementTexture *pLayerElementTextures, int pPolygonIndex, int pOffset) |
void | RemoveUVIndex (KFbxLayerElementUV *pLayerElementUV, int pPolygonIndex, int pOffset) |
K_DEPRECATED bool | IsBadPoly (int pPolygonIndex) const |
bool | GetBadPolyIndices (KArrayTemplate< int > &pArrayBadPolyIndices, bool pCheckOne) const |
Get bad polygon indices in one mesh.
|
|
KFbxMesh (KFbxSdkManager &pManager, char const *pName) | |
virtual void | Destruct (bool pRecursive, bool pDependents) |
int | FindPolygonIndex (int pEdgeIndex) |
void | PolySetTexture (KFbxLayer *pLayer, int pTextureIndex, KFbxLayerElement::ELayerElementType pTextureType) |
template<class T > | |
bool | GetPolygonVertexLayerElementValue (const KFbxLayerElementTemplate< T > *pLayerElement, int pPolyIndex, int pVertexIndex, T &pValue) const |
Static Protected Member Functions |
|
static int | PolygonIndexCompare (const void *p1, const void *p2) |
Protected Attributes |
|
EMeshSmoothness | mSmoothness |
int | mPreviewDivisionLevels |
int | mRenderDivisionLevels |
bool | mDisplaySubdivisions |
EBoundaryRule | mBoundaryRule |
bool | mPreserveBorders |
bool | mPreserveHardEdges |
bool | mPropagateEdgeHardness |
KFbxV2PVMap | mV2PVMap |
KFbxEdgeLookup | mPVEndFlags |
Friends |
|
class | KFbxGeometryConverter |
class | KFbxWriter3DS |
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, KFbxVector4 &pNormal) const |
Get the normal associated with the specified
polygon vertex. |
|
bool | GetPolygonVertexNormals (KArrayTemplate< KFbxVector4 > &pNormals) const |
Get the normals associated with the mesh for
every polygon vertex. |
|
bool | GetPolygonVertexUV (int pPolyIndex, int pVertexIndex, const char *pUVSetName, KFbxVector2 &pUV) const |
Get the UV associated with the specified
polygon vertex. |
|
bool | GetPolygonVertexUVs (const char *pUVSetName, KArrayTemplate< KFbxVector2 > &pUVs) 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 (KArrayTemplate< 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 KFbxLayer
and KFbxLayerElementUV
methods to do the job. Except for the
GetAllChannelUV(int pLayer), all the methods are implicitly
working on Layer 0. Use the KFbxLayer
methods to have access to the other layers. |
|
void | InitTextureUV (int pCount, KFbxLayerElement::ELayerElementType pTypeIdentifier=KFbxLayerElement::eDIFFUSE_TEXTURES) |
Init texture UV coordinates. |
|
void | AddTextureUV (KFbxVector2 pUV, KFbxLayerElement::ELayerElementType pTypeIdentifier=KFbxLayerElement::eDIFFUSE_TEXTURES) |
Add texture UV coordinates. |
|
int | GetTextureUVCount (KFbxLayerElement::ELayerElementType pTypeIdentifier=KFbxLayerElement::eDIFFUSE_TEXTURES) |
Get the number of texture UV coordinates.
|
|
int | GetUVLayerCount () const |
Get the number of layer containing at least
one channel UVMap. |
|
KArrayTemplate < KFbxLayerElement::ELayerElementType > |
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 KFbxLayer
and KFbxLayerElementUV
methods to do the job. These functions are only working on Layer 0.
Use the KFbxLayer
methods directly to access other layers. |
|
void | InitMaterialIndices (KFbxLayerElement::EMappingMode pMappingMode) |
Initialize material indices. |
|
void | InitTextureIndices (KFbxLayerElement::EMappingMode pMappingMode, KFbxLayerElement::ELayerElementType pTextureType) |
Initialize texture indices. |
|
void | InitTextureUVIndices (KFbxLayerElement::EMappingMode pMappingMode, KFbxLayerElement::ELayerElementType pTypeIdentifier=KFbxLayerElement::eDIFFUSE_TEXTURES) |
Initialize texture UV indices. |
|
int | GetTextureUVIndex (int pPolygonIndex, int pPositionInPolygon, KFbxLayerElement::ELayerElementType pTypeIdentifier=KFbxLayerElement::eDIFFUSE_TEXTURES) |
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, KFbxLayerElement::ELayerElementType pTypeIdentifier) |
Set a texture UV index associated with a
polygon vertex (i.e: an index to a control point). |
|
Utility functions |
|
enum | ESplitObject { eBY_NORMAL } |
Object of interest when splitting. More... |
|
void | Reset () |
Reset the mesh to default values. |
|
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 (KFbxLayerElement::ELayerElementType pTypeIdentifier=KFbxLayerElement::eDIFFUSE_TEXTURES) |
Split points. |
|
bool | BuildMergeList (KArrayTemplate< int > &pMergeList, ESplitObject pObject, bool pExport=false) |
Insert the new indexes of the object that
have to be merged. |
|
void | MergePointsForPolygonVerteNormals (KArrayTemplate< 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. |
|
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. |
|
void | ComputeComponentMaps (KFbxComponentMap &pEdgeToPolyMap, KFbxComponentMap &pPolyToEdgeMap) |
Compute component maps. |
|
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 (KFbxLayerElementArrayTemplate< double > **pCreaseArray) |
Get crease edge array. |
|
double | GetVertexCreaseInfo (int pVertexIndex) |
Get crease weight by vertex index. |
|
bool | GetVertexCreaseInfoArray (KFbxLayerElementArrayTemplate< double > **pCreaseArray) |
Get vertex crease array. |
|
bool | SetEdgeCreaseInfo (int pEdgeIndex, double pWeight) |
Set crease weight by edge index. |
|
bool | SetEdgeCreaseInfoArray (KArrayTemplate< double > *pWeightArray) |
Set crease weight data array. |
|
bool | SetVertexCreaseInfo (int pVertexIndex, double pWeight) |
Set crease weight by vertex index. |
|
bool | SetVertexCreaseInfoArray (KArrayTemplate< double > *pWeightArray) |
Set crease weight data array. |
|
Smooth mesh preview utility functions |
|
enum | EMeshSmoothness { eHULL, eROUGH, eMEDIUM, eFINE } |
Display Smoothness. More... |
|
enum | EBoundaryRule { eLEGACY, eCREASE_ALL, eCREASE_EDGES } |
the boundary rule. More... |
|
KFbxMesh::EMeshSmoothness | GetMeshSmoothness () const |
Get display smoothness from mesh. |
|
void | SetMeshSmoothness (KFbxMesh::EMeshSmoothness 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. |
|
EBoundaryRule | GetBoundaryRule () 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.
|
|
Hole utility functions |
|
bool | GetPolyHoleInfo (int pFaceIndex) |
Get hole flag by face index (an index to a
polygon). |
|
bool | GetPolyHoleInfoArray (KFbxLayerElementArrayTemplate< 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 (KArrayTemplate< bool > *pHoleArray) |
Set hole flags array. |
|
Tangents data generate utility functions. |
|
bool | GenerateTangentsData (KString pUVSetName="") |
Generate tangents data for UVSet with
specific name. |
|
bool | GenerateTangentsData (int pUVSetLayerIndex) |
Generate tangents data for UVSet in specific
layer. |
|
bool | GenerateTangentsDataForAllUVSets () |
Generate tangents data for all UVSets in all
layers. |
enum ESplitObject |
Object of interest when splitting.
eBY_NORMAL |
Each split point will have a different normal for polygon/vertex. This is for normal mapping emulation. |
Definition at line 420 of file kfbxmesh.h.
{ eBY_NORMAL } ESplitObject;
enum EMeshSmoothness |
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.
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 728 of file kfbxmesh.h.
enum EBoundaryRule |
the boundary rule.
eLEGACY |
Default value. |
eCREASE_ALL |
Used for hard corner. |
eCREASE_EDGES |
Used for round corner. |
Definition at line 739 of file kfbxmesh.h.
{ eLEGACY, eCREASE_ALL, eCREASE_EDGES };
KFbxMesh | ( | KFbxSdkManager & | pManager, |
char const * | pName | ||
) | [protected] |
virtual EAttributeType GetAttributeType | ( | ) | const [virtual] |
Return the type of node attribute.
Reimplemented from KFbxGeometry.
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.
pMaterial | Index of material to assign to this polygon if material mapping
type is eBY_POLYGON. Otherwise it must be
-1 . |
pTexture | Index of texture to assign to this polygon if texture mapping
type is eBY_POLYGON. Otherwise it must be
-1 . |
pGroup | Group index assigned to polygon. |
pLegacy | When 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. |
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.
pMaterial | Index of material to assign to this polygon if material mapping
type is eBY_POLYGON. Otherwise it must be
-1 . |
pTextures | Array of index of texture (by texture type) to assign to this
polygon if texture mapping type is eBY_POLYGON. Otherwise
it must be an array of -1 . This array is expected to
be of size: KFbxLayerElement::LAYERELEMENT_TYPE_TEXTURE_COUNT.
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.
pIndex | Index in the table of the control points. |
pTextureUVIndex | Index of texture UV coordinates to assign to this polygon if
texture UV mapping type is eBY_POLYGON_VERTEX. Otherwise
it must be -1 . |
void EndPolygon | ( | ) |
End writing a polygon, it should be called after adding one polygon.
int GetPolygonCount | ( | ) | const [inline] |
Get the polygon count of this mesh.
Definition at line 124 of file kfbxmesh.h.
int GetPolygonSize | ( | int | pPolygonIndex | ) | const [inline] |
Get the number of polygon vertices in a polygon.
pPolygonIndex | Index of the polygon. |
Definition at line 131 of file kfbxmesh.h.
int GetPolygonGroup | ( | int | pPolygonIndex | ) | const |
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.
pPolygonIndex | Index of the polygon. |
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.
pPolygonIndex | Index of the polygon. |
pGroup | Group index assigned to the polygon. |
Definition at line 153 of file kfbxmesh.h.
int GetPolygonVertex | ( | int | pPolygonIndex, |
int | pPositionInPolygon | ||
) | const [inline] |
Get a polygon vertex (i.e: an index to a control point).
pPolygonIndex | Index of queried polygon. The valid range for this parameter is
0 to KFbxMesh::GetPolygonCount() . |
pPositionInPolygon | Position of polygon vertex in indexed polygon. The valid range
for this parameter is 0 to
KFbxMesh::GetPolygonSize(pPolygonIndex) . |
Definition at line 167 of file kfbxmesh.h.
{ return (pPolygonIndex >= 0 && pPolygonIndex < mPolygons.GetCount() && pPositionInPolygon >= 0 && pPositionInPolygon < mPolygons[pPolygonIndex].mSize) ? mPolygonVertices[mPolygons[pPolygonIndex].mIndex + pPositionInPolygon] : -1; }
bool GetPolygonVertexNormal | ( | int | pPolyIndex, |
int | pVertexIndex, | ||
KFbxVector4 & | pNormal | ||
) | const |
Get the normal associated with the specified polygon vertex.
pPolyIndex | Index of the polygon. |
pVertexIndex | Index of the vertex in the polygon. |
pNormal | The returned normal. |
True
on success, false
on
failure.pNormal
remain unchanged if the requested vertex
does not exists.bool GetPolygonVertexNormals | ( | KArrayTemplate< KFbxVector4 > & | pNormals | ) | const |
Get the normals associated with the mesh for every polygon vertex.
pNormals | The returned normals. |
True
on success, false
on
failure.bool GetPolygonVertexUV | ( | int | pPolyIndex, |
int | pVertexIndex, | ||
const char * | pUVSetName, | ||
KFbxVector2 & | pUV | ||
) | const |
Get the UV associated with the specified polygon vertex.
pPolyIndex | Index of the polygon. |
pVertexIndex | Index of the vertex in the polygon. |
pUVSetName | The name of the UV set that contains the UV. |
pUV | The returned UV. |
True
on success, false
on
failure.pUV
remain unchanged if the requested vertex does
not exists.bool GetPolygonVertexUVs | ( | const char * | pUVSetName, |
KArrayTemplate< KFbxVector2 > & | pUVs | ||
) | const |
Get the UVs associated with the mesh for every polygon vertex.
pUVSetName | The name of the UV set that contains the UVs. |
pUVs | The returned UVs. |
True
on success, false
on
failure.int* GetPolygonVertices | ( | ) | const |
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.
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.
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
int lStartIndex = mesh.GetPolygonVertexIndex(3); if (lStartIndex == -1) return; int* lVertices = mesh.GetPolygonVertices()[lStartIndex]; int lCount = mesh.GetPolygonSize(3); for (int i = 0; i < lCount; i++) { int vertexID = lVertices[i]; ... }
pPolygonIndex | The polygon of interest. |
int RemovePolygon | ( | int | pPolygonIndex | ) |
Remove the specified polygon from the mesh.
This method will automatically update the layers accordingly.
pPolygonIndex | Index of the polygon. |
int RemoveDuplicatedEdges | ( | KArrayTemplate< 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.
pEdgeIndexList | Index list of edges. |
void InitTextureUV | ( | int | pCount, |
KFbxLayerElement::ELayerElementType | pTypeIdentifier =
KFbxLayerElement::eDIFFUSE_TEXTURES |
||
) |
Init texture UV coordinates.
pCount | Number of texture UV elements. |
pTypeIdentifier | Specifies which texture channel this UV refers to. |
pCount
must equal the number of control points of
the Mesh if the UV mapping mode is
KFbxLayerElement::eBY_CONTROL_POINT.void AddTextureUV | ( | KFbxVector2 | pUV, |
KFbxLayerElement::ELayerElementType | pTypeIdentifier =
KFbxLayerElement::eDIFFUSE_TEXTURES |
||
) |
Add texture UV coordinates.
Appends a new element at the end of the array of texture UV coordinates.
pUV | Texture UV coordinates, ranging between 0 and
1 . |
pTypeIdentifier | Specifies which texture channel this UV refers to. |
int GetTextureUVCount | ( | KFbxLayerElement::ELayerElementType | pTypeIdentifier =
KFbxLayerElement::eDIFFUSE_TEXTURES |
) |
Get the number of texture UV coordinates.
pTypeIdentifier | The texture channel the UV refers to. |
int GetUVLayerCount | ( | ) | const |
Get the number of layer containing at least one channel UVMap.
return 0 if no UV maps have been defined.
KArrayTemplate<KFbxLayerElement::ELayerElementType> GetAllChannelUV | ( | int | pLayer | ) |
Fills an array describing, for the given layer, which texture channel have UVs associated to it.
pLayer | Index of the layer. |
void InitMaterialIndices | ( | KFbxLayerElement::EMappingMode | pMappingMode | ) |
Initialize material indices.
pMappingMode | The mapping mode. This method must be called after KFbxGeometryBase::InitControlPoints().
The material indices refer to the position of a material in the
KFbxLayerElementMaterial's direct array. See
KFbxLayerElementMaterial for more details. Supported mapping
types are eBY_CONTROL_POINT, eBY_POLYGON and
eALL_SAME.
|
void InitTextureIndices | ( | KFbxLayerElement::EMappingMode | pMappingMode, |
KFbxLayerElement::ELayerElementType | pTextureType | ||
) |
Initialize texture indices.
pMappingMode | The 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
KFbxLayerElementTexture.
See KFbxLayerElementTexture
for more details. Supported mapping modes are eBY_POLYGON
and eALL_SAME.
|
pTextureType | The texture channel identifier. |
void InitTextureUVIndices | ( | KFbxLayerElement::EMappingMode | pMappingMode, |
KFbxLayerElement::ELayerElementType | pTypeIdentifier =
KFbxLayerElement::eDIFFUSE_TEXTURES |
||
) |
Initialize texture UV indices.
pMappingMode | The mapping mode. The texture UV indices refer to the index of
an element in the KFbxLayerElementUV's direct array. See KFbxLayerElementUV
for more details. Supported mapping types are
eBY_CONTROL_POINT , eBY_POLYGON_VERTEX and
eALL_SAME.
|
pTypeIdentifier | The texture channel the UVIndices refers to. |
int GetTextureUVIndex | ( | int | pPolygonIndex, |
int | pPositionInPolygon, | ||
KFbxLayerElement::ELayerElementType | pTypeIdentifier =
KFbxLayerElement::eDIFFUSE_TEXTURES |
||
) |
Get a texture UV index associated with a polygon vertex (i.e: an index to a control point).
pPolygonIndex | Index of polygon. The valid range for this parameter is 0 to KFbxMesh::GetPolygonCount(). |
pPositionInPolygon | Position of polygon vertex in indexed polygon. The valid range for this parameter is 0 to KFbxMesh::GetPolygonSize(pPolygonIndex). |
pTypeIdentifier | The texture channel the UVIndex refers to. |
void SetTextureUVIndex | ( | int | pPolygonIndex, |
int | pPositionInPolygon, | ||
int | pIndex, | ||
KFbxLayerElement::ELayerElementType | pTypeIdentifier | ||
) |
Set a texture UV index associated with a polygon vertex (i.e: an index to a control point).
pPolygonIndex | Index of polygon. The valid range for this parameter is 0 to KFbxMesh::GetPolygonCount(). |
pPositionInPolygon | Position of polygon vertex in indexed polygon. The valid range for this parameter is 0 to KFbxMesh::GetPolygonSize(pPolygonIndex). |
pIndex | The index of the texture UV we want to assign to the polygon vertex. |
pTypeIdentifier | The texture channel the UVIndex refers to. |
void Reset | ( | ) |
Reset the mesh to default values.
Frees and set to NULL
all layers and clear the
polygon and the control point array.
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.
pCW | True if the normals are calculated clockwise, false otherwise (counter-clockwise). |
bool CheckIfVertexNormalsCCW | ( | ) |
Compares the normals calculated by doing cross-products between the polygon vertex and by the ones stored in the normal array.
false
if ALL of them are Clockwise. Returns
true
otherwise.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.
Degenerate polygons use a vertex more than once. Remove them from the mesh and from the layer element indices as needed.
bool SplitPoints | ( | KFbxLayerElement::ELayerElementType | pTypeIdentifier =
KFbxLayerElement::eDIFFUSE_TEXTURES |
) |
Split points.
pTypeIdentifier | Specify which UVs are processed. |
true
if a split occurred, false otherwise.bool BuildMergeList | ( | KArrayTemplate< int > & | pMergeList, |
ESplitObject | pObject, | ||
bool | pExport =
false |
||
) |
Insert the new indexes of the object that have to be merged.
pMergeList | The list that will contain the indexes of the objects to merge. |
pObject | The object of interest of the merge. |
pExport | If set to true , include the duplicate indexes in
the merge list. |
void MergePointsForPolygonVerteNormals | ( | KArrayTemplate< int > & | pMergeList | ) |
Merge the points specified in the list.
pMergeList | List containing the information on the points that will be merged. |
void BuildMeshEdgeArray | ( | ) |
Automatically generate edge data for the mesh.
Clears all previously stored edge information
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.
Note that the result of this method is the same if pStartVertexIndex and pEndVertexIndex are swapped.
pStartVertexIndex | The starting point of the edge. |
pEndVertexIndex | The ending point of the edge. |
pReversed | flag will be set to true if the reverse edge is found, false otherwise. |
pExistedEdgeCount | legal edge count in mEdgeArray |
int GetMeshEdgeIndexForPolygon | ( | int | pPolygon, |
int | pPositionInPolygon | ||
) |
Get the index for the specific edge of pPolygon.
pPolygon | The polygon of interest. |
pPositionInPolygon | The specific edge number in the polygon. |
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.
pEdgeIndex | The edge to query. |
pStartVertexIndex | The edge's starting point will be stored here. |
pEndVertexIndex | The edge's starting point will be stored here. |
void BeginGetMeshEdgeVertices | ( | ) |
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.
void 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.
void SetMeshEdgeCount | ( | int | pEdgeCount | ) |
Presets the number edge data elements.
pEdgeCount | The number of edges to allocate. |
void SetMeshEdge | ( | int | pEdgeIndex, |
int | pValue | ||
) | [inline] |
Sets element in edge array to specific value.
pEdgeIndex | The edge index |
pValue | The edge data |
Definition at line 564 of file kfbxmesh.h.
{ if( pEdgeIndex >= 0 && pEdgeIndex < mEdgeArray.GetCount() ) mEdgeArray[pEdgeIndex] = pValue; }
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.
pStartVertexIndex | The starting point of the edge. |
pEndVertexIndex | The ending point of the edge. |
pCheckForDuplicates | Set 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. |
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.
pEdgeIndex | The edge index of the edge. |
pStartVertexIndex | The starting point of the edge. |
pEndVertexIndex | The ending point of the edge. |
pCheckForDuplicates | Set 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. |
pExistedEdgeCount | the 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. |
void BeginAddMeshEdgeIndex | ( | ) |
Call this before calling AddMeshEdgeIndex or SetMeshEdgeIndex to increase performance.
Once finished adding/setting edges EndAddMeshEdgeIndex should be called.
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.
See SetMeshEdgeIndex for notes the the parameters.
pPolygonIndex | The polygon of interest. |
pPositionInPolygon | The edge within the polygon |
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
pEdgeIndex | The edge. |
pPolygonIndex | The polygon. |
pPositionInPolygon | The specific edge number in the polygon. |
void ComputeComponentMaps | ( | KFbxComponentMap & | pEdgeToPolyMap, |
KFbxComponentMap & | pPolyToEdgeMap | ||
) |
Compute component maps.
bool IsTriangleMesh | ( | ) | const |
Determines if the mesh is composed entirely of triangles.
void ReservePolygonCount | ( | int | pCount | ) | [inline] |
Reserve memory in the polygon array to hold the specified number of polygons.
pCount | The number of polygons this mesh will hold |
Definition at line 649 of file kfbxmesh.h.
void ReservePolygonVertexCount | ( | int | pCount | ) | [inline] |
Reserve memory in the polygon vertex array to hold the specified number of polygon vertices.
pCount | The number of polygon vertices |
Definition at line 655 of file kfbxmesh.h.
{ mPolygonVertices.Reserve( pCount ); }
bool GetTextureUV | ( | KFbxLayerElementArrayTemplate< KFbxVector2 > ** | pLockableArray, |
KFbxLayerElement::ELayerElementType | pTypeIdentifier =
KFbxLayerElement::eDIFFUSE_TEXTURES |
||
) | const |
bool GetMaterialIndices | ( | KFbxLayerElementArrayTemplate< int > ** | pLockableArray | ) | const |
bool GetTextureIndices | ( | KFbxLayerElementArrayTemplate< int > ** | pLockableArray, |
KFbxLayerElement::ELayerElementType | pTextureType | ||
) | const |
double GetEdgeCreaseInfo | ( | int | pEdgeIndex | ) |
Get crease weight by edge index.
pEdgeIndex | Edge index. |
bool GetEdgeCreaseInfoArray | ( | KFbxLayerElementArrayTemplate< double > ** | pCreaseArray | ) |
Get crease edge array.
pCreaseArray | Edge crease data array. |
true
if the pCreaseArray is filled
successfully.double GetVertexCreaseInfo | ( | int | pVertexIndex | ) |
Get crease weight by vertex index.
pVertexIndex | Vertex index. |
bool GetVertexCreaseInfoArray | ( | KFbxLayerElementArrayTemplate< double > ** | pCreaseArray | ) |
Get vertex crease array.
pCreaseArray | Edge vertex data array. |
true
if the pCreaseArray is filled
successfully.bool SetEdgeCreaseInfo | ( | int | pEdgeIndex, |
double | pWeight | ||
) |
Set crease weight by edge index.
pEdgeIndex | Edge index. |
pWeight | Crease weight value in the range [0.0 - 1.0]. |
true
if successfully set the crease weight.bool SetEdgeCreaseInfoArray | ( | KArrayTemplate< double > * | pWeightArray | ) |
Set crease weight data array.
pWeightArray | Edge crease data. |
true
if successfully set the crease weight.bool SetVertexCreaseInfo | ( | int | pVertexIndex, |
double | pWeight | ||
) |
Set crease weight by vertex index.
pVertexIndex | Vertex index. |
pWeight | Crease weight value in the range [0.0 - 1.0]. |
true
if successfully set the crease weight.bool SetVertexCreaseInfoArray | ( | KArrayTemplate< double > * | pWeightArray | ) |
Set crease weight data array.
pWeightArray | Vertex crease data. |
true
if successfully set the crease weight.KFbxMesh::EMeshSmoothness GetMeshSmoothness | ( | ) | const |
Get display smoothness from mesh.
void SetMeshSmoothness | ( | KFbxMesh::EMeshSmoothness | pSmoothness | ) |
Set the mesh display smoothness mode.
pSmoothness | New smoothness factor. |
int GetMeshPreviewDivisionLevels | ( | ) | const |
Get preview subdivision levels from mesh.
void SetMeshPreviewDivisionLevels | ( | int | pPreviewDivisionLevels | ) |
Set mesh preview subdivision levels.
pPreviewDivisionLevels | Number of subdivisions levels. |
int GetMeshRenderDivisionLevels | ( | ) | const |
Get render subdivision levels from mesh.
void SetMeshRenderDivisionLevels | ( | int | pRenderDivisionLevels | ) |
Set mesh render subdivision levels.
pRenderDivisionLevels | Number of subdivision levels. |
bool GetDisplaySubdivisions | ( | ) | const |
Query whether to display subdivisions isolines on mesh.
void SetDisplaySubdivisions | ( | bool | pDisplySubdivisions | ) |
Set the DisplySubdivisions state.
pDisplySubdivisions | New value for this flag. |
EBoundaryRule GetBoundaryRule | ( | ) | const |
Get BoundaryRule from mesh.
void SetBoundaryRule | ( | EBoundaryRule | pBoundaryRule | ) |
Set BoundaryRule for this mesh.
pBoundaryRule | New value for the internal state of 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.
pPreserveBorders | New value for this 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.
pPreserveHardEdges | New value for this flag. |
bool GetPropagateEdgeHardness | ( | ) | const |
Query whether to PropagateEdgeHardness when preview smooth mesh.
void SetPropagateEdgeHardness | ( | bool | pPropagateEdgeHardness | ) |
Set state of the PropagateEdgeHardness flag.
pPropagateEdgeHardness | New value for this flag. |
bool GetPolyHoleInfo | ( | int | pFaceIndex | ) |
Get hole flag by face index (an index to a polygon).
pFaceIndex | Index of the queried polygon. |
bool GetPolyHoleInfoArray | ( | KFbxLayerElementArrayTemplate< bool > ** | pHoleArray | ) |
Get hole flags Array.
pHoleArray | Hole flags array. |
true
if the pHoleArray is filled
successfully.bool SetPolyHoleInfo | ( | int | pFaceIndex, |
bool | pIsHole | ||
) |
Sets the flag indicating whether the face represents a hole or not.
pFaceIndex | Index of the processed polygon. |
pIsHole | If true , this face represent a hole. |
true
if successfully set the hole info.bool SetPolyHoleInfoArray | ( | KArrayTemplate< bool > * | pHoleArray | ) |
Set hole flags array.
pHoleArray | Hole flag array. |
true
if successfully set the hole flags.bool GenerateTangentsData | ( | KString | pUVSetName = "" |
) |
Generate tangents data for UVSet with specific name.
pUVSetName | The UVSet name to generate tangents data with. The UVSet on the first layer is the the default UVSet to generate. |
true
if successfully generate tangents data.bool GenerateTangentsData | ( | int | pUVSetLayerIndex | ) |
Generate tangents data for UVSet in specific layer.
pUVSetLayerIndex | The layer to generate tangents data with. |
true
if successfully generate tangents data.bool GenerateTangentsDataForAllUVSets | ( | ) |
Generate tangents data for all UVSets in all layers.
true
if successfully generate tangents data.virtual KFbxObject& Copy | ( | const KFbxObject & | pObject | ) | [virtual] |
Copy an object content into this object.
pObject | The source object to copy data from. |
Reimplemented from KFbxGeometry.
void InitTextureIndices | ( | KFbxLayerElementTexture * | pLayerElementTexture, |
KFbxLayerElement::EMappingMode | pMappingMode | ||
) | [protected] |
void RemoveTextureIndex | ( | KFbxLayerElementTexture * | pLayerElementTextures, |
int | pPolygonIndex, | ||
int | pOffset | ||
) | [protected] |
void RemoveUVIndex | ( | KFbxLayerElementUV * | pLayerElementUV, |
int | pPolygonIndex, | ||
int | pOffset | ||
) | [protected] |
K_DEPRECATED bool IsBadPoly | ( | int | pPolygonIndex | ) | const [protected] |
bool GetBadPolyIndices | ( | KArrayTemplate< int > & | pArrayBadPolyIndices, |
bool | pCheckOne | ||
) | const [protected] |
Get bad polygon indices in one mesh.
pArrayBadPolyIndices | return the bad polygon indices |
pCheckOne | if true, only check if there is bad polygon in mesh. Otherwise, get all bad polygons |
virtual void Destruct | ( | bool | pRecursive, |
bool | pDependents | ||
) | [protected, virtual] |
Reimplemented from KFbxGeometry.
int FindPolygonIndex | ( | int | pEdgeIndex | ) | [protected] |
static int PolygonIndexCompare | ( | const void * | p1, |
const void * | p2 | ||
) | [static, protected] |
void PolySetTexture | ( | KFbxLayer * | pLayer, |
int | pTextureIndex, | ||
KFbxLayerElement::ELayerElementType | pTextureType | ||
) | [protected] |
bool GetPolygonVertexLayerElementValue | ( | const KFbxLayerElementTemplate< T > * | pLayerElement, |
int | pPolyIndex, | ||
int | pVertexIndex, | ||
T & | pValue | ||
) | const [protected] |
friend class KFbxGeometryConverter
[friend] |
Reimplemented from KFbxGeometryBase.
Definition at line 1002 of file kfbxmesh.h.
friend class KFbxWriter3DS
[friend] |
Definition at line 1003 of file kfbxmesh.h.
EMeshSmoothness
mSmoothness
[protected] |
Definition at line 945 of file kfbxmesh.h.
int mPreviewDivisionLevels
[protected] |
Definition at line 946 of file kfbxmesh.h.
int mRenderDivisionLevels
[protected] |
Definition at line 947 of file kfbxmesh.h.
bool mDisplaySubdivisions
[protected] |
Definition at line 949 of file kfbxmesh.h.
EBoundaryRule
mBoundaryRule
[protected] |
Definition at line 950 of file kfbxmesh.h.
bool mPreserveBorders
[protected] |
Definition at line 951 of file kfbxmesh.h.
bool mPreserveHardEdges
[protected] |
Definition at line 952 of file kfbxmesh.h.
bool mPropagateEdgeHardness
[protected] |
Definition at line 953 of file kfbxmesh.h.
Definition at line 960 of file kfbxmesh.h.
Definition at line 961 of file kfbxmesh.h.
KFbxV2PVMap
mV2PVMap
[protected] |
Definition at line 979 of file kfbxmesh.h.
KFbxEdgeLookup
mPVEndFlags
[protected] |
Definition at line 987 of file kfbxmesh.h.
KArrayTemplate< int > mEdgeArray |
Definition at line 990 of file kfbxmesh.h.