- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Namespace List
- Namespace Members

# FCDGeometryPolygonsTools Namespace Reference

Holds commonly-used transformation functions for meshes and polygons sets. More...

## Functions
FCOLLADA_EXPORT void | Triangulate (FCDGeometryMesh *mesh)
| Triangulates a mesh.
FCOLLADA_EXPORT void | Triangulate (FCDGeometryPolygons *polygons, bool recalculate=true)
| Triangulates a polygons set.
FCOLLADA_EXPORT void | GenerateTextureTangentBasis (FCDGeometryMesh *mesh, FCDGeometrySource *texcoordSource, bool generateBinormals=true)
| Generates the texture tangents and binormals for a given source of texture coordinates.
FCOLLADA_EXPORT void | GenerateUniqueIndices (FCDGeometryMesh *mesh, FCDGeometryPolygons *polygons=NULL, FCDGeometryIndexTranslationMap *translationMap=NULL)
| Prepares the mesh for using its geometry sources in vertex buffers with a unique index buffer.
FCOLLADA_EXPORT void | GenerateUniqueIndices (FCDGeometryMesh *mesh, FCDGeometryPolygons *polygonsToProcess, FCDNewIndicesList &outIndices, FCDGeometryIndexTranslationMapList &outTranslationMaps)
| Prepares the mesh for using its geometry sources in vertex buffers with a unique index buffer.
FCOLLADA_EXPORT void | ApplyUniqueIndices (float *targData, float *srcData, uint32 stride, const FCDGeometryIndexTranslationMap *translationMap)
| Applies the translation map onto some vertex data.
FCOLLADA_EXPORT void | ApplyUniqueIndices (FCDGeometryMesh *targMesh, FCDGeometryMesh *baseMesh, const UInt32List &newIndices, const FCDGeometryIndexTranslationMapList &translationMaps)
| Applies the translation map onto some vertex data.
FCOLLADA_EXPORT void | RevertUniqueIndices (const FCDGeometryPolygonsInput &inSrc, FCDGeometryPolygonsInput &outSrc, const FCDGeometryIndexTranslationMap &translationMap)
| Reverts the modifications done when applying the unique index buffer data translation unto some polygons input.
FCOLLADA_EXPORT void | PackVertexBufferV3 (uint8 *destBuffer, uint32 destBuffStride, const FCDGeometrySource *source, uint32 vCount, uint16 *vtxPackingMap, const FCDGeometryIndexTranslationMap &translationMap)
| Used to pack a vertex buffer object with 3D float vertex data.
FCOLLADA_EXPORT void | PackVertexBufferColor (uint8 *destBuffer, uint32 destBuffStride, const FCDGeometrySource *source, uint32 vCount, uint16 *vtxPackingMap, const FCDGeometryIndexTranslationMap &translationMap)
| Used to pack a vertex buffer object object with 4 bytes color data.
FCOLLADA_EXPORT void | PackVertexBufferV2 (uint8 *destBuffer, uint32 destBuffStride, const FCDGeometrySource *source, uint32 vCount, uint16 *vtxPackingMap, const FCDGeometryIndexTranslationMap &translationMap)
| Used to pack a vertex buffer object object with 2D float vertex data.
FCOLLADA_EXPORT uint16 | GenerateVertexPackingMap (size_t maxIndex, size_t maxIndices, size_t maxVertices, const uint32 *inIndices, uint16 *outIndices, UInt16List *outPackingMap, uint16 *outNVertices=NULL)
| Generates a packing map for a mesh' given vertex data.
FCOLLADA_EXPORT uint32 | FindLargestUniqueIndex (const FCDGeometryIndexTranslationMap &translationMap)
| Retrieves the largest unique index within a given translation map.
FCOLLADA_EXPORT void | FitIndexBuffers (FCDGeometryMesh *mesh, size_t maximumIndexCount)
| Splits the mesh's polygons sets to ensure that none of them have more than a given number of indices within their index buffers.
FCOLLADA_EXPORT void | ReverseNormals (FCDGeometryMesh *mesh)
| Reverses all the normals of a mesh.

## Detailed Description

Holds commonly-used transformation functions for meshes and polygons sets.

## Function Documentation

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::ApplyUniqueIndices | ( | FCDGeometryMesh * | targMesh,
|  | FCDGeometryMesh * | baseMesh,
|  | const UInt32List & | newIndices,
|  | const FCDGeometryIndexTranslationMapList & | translationMaps
| ) |

  | Applies the translation map onto some vertex data. Refer to the information within the translation map to pre-cache the necessary amount of vertices. Parameters:
  | targMesh | The mesh object to be modified in-place.
  | baseMesh | The original mesh object that contains the original vertex data.
  | newIndices | The unique index buffer data.
  | translationMaps | How the vertex data needs to be relocated in order to use the unique index buffer data.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::ApplyUniqueIndices | ( | float * | targData,
|  | float * | srcData,
|  | uint32 | stride,
|  | const FCDGeometryIndexTranslationMap * | translationMap
| ) |

  | Applies the translation map onto some vertex data. Refer to the information within the translation map to pre-cache the necessary amount of vertices. Parameters:
  | targData | The vertex buffer data to be filled-in.
  | srcData | The original vertex data.
  | stride | The stride within the target vertex buffer data and within the orignal vertex data.
  | translationMap | How to relocate the vertex data.

FCOLLADA_EXPORT uint32 FCDGeometryPolygonsTools::FindLargestUniqueIndex | ( | const FCDGeometryIndexTranslationMap & | translationMap | ) |

  | Retrieves the largest unique index within a given translation map. This function is unnecessary expensive and we suggest that you cache its results. Parameters:
  | translationMap | A translation map.
Returns: The largest unique index within the translation map.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::FitIndexBuffers | ( | FCDGeometryMesh * | mesh,
|  | size_t | maximumIndexCount
| ) |

  | Splits the mesh's polygons sets to ensure that none of them have more than a given number of indices within their index buffers. If you intend of using the GenerateUniqueIndices tool on your meshes, you should run it before this tool. This function affects only the indices and the number of polygon sets within a mesh and therefore has no impact on skins or morphers attached to the given mesh. Parameters:
  | mesh | The mesh to process.
  | maximumIndexCount | The maximum number of indices to have within each polygons set.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::GenerateTextureTangentBasis | ( | FCDGeometryMesh * | mesh,
|  | FCDGeometrySource * | texcoordSource,
|  | bool | generateBinormals = `true`
| ) |

  | Generates the texture tangents and binormals for a given source of texture coordinates. A source of normals and a source of vertex positions will be expected. Parameters:
  | mesh | The mesh that contains the texture coordinate source.
  | texcoordSource | The source of texture coordinates that needs its tangents and binormals generated.
  | generateBinormals | Whether the binormals should also be generated. Do note that the binormal is always the cross-product of the tangent and the normal at a vertex-face pair.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::GenerateUniqueIndices | ( | FCDGeometryMesh * | mesh,
|  | FCDGeometryPolygons * | polygonsToProcess,
|  | FCDNewIndicesList & | outIndices,
|  | FCDGeometryIndexTranslationMapList & | outTranslationMaps
| ) |

  | Prepares the mesh for using its geometry sources in vertex buffers with a unique index buffer. This is useful for older engines and the applications that only support one index per face-vertex pair. This version of the GenerateUniqueIndices function fills in the outTranslationMaps, but does not modify the data in the FCDGeometryPolygon objects. Parameters:
  | mesh | The mesh to process.
  | polygons | The polygons set to isolate and process. If this pointer is NULL, the whole mesh is processed for one index buffer.
  | outIndices | The unique index buffer data.
  | outTranslationMaps | How the vertex data needs to be relocated in order to use the unique index buffer data.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::GenerateUniqueIndices | ( | FCDGeometryMesh * | mesh,
|  | FCDGeometryPolygons * | polygons = `NULL`,
|  | FCDGeometryIndexTranslationMap * | translationMap = `NULL`
| ) |

  | Prepares the mesh for using its geometry sources in vertex buffers with a unique index buffer. This is useful for older engines and the applications that only support one index per face-vertex pair. Parameters:
  | mesh | The mesh to process.
  | polygons | The polygons set to isolate and process. If this pointer is NULL, the whole mesh is processed for one index buffer.
  | translationMap | Optional map that returns how to translate old vertex position indices into new indices. This map is necessary to support skins and morphers.

FCOLLADA_EXPORT uint16 FCDGeometryPolygonsTools::GenerateVertexPackingMap | ( | size_t | maxIndex,
|  | size_t | maxIndices,
|  | size_t | maxVertices,
|  | const uint32 * | inIndices,
|  | uint16 * | outIndices,
|  | UInt16List * | outPackingMap,
|  | uint16 * | outNVertices = `NULL`
| ) |

  | Generates a packing map for a mesh' given vertex data. Parameters:
  | maxIndex | The total number of indices in the input index data.
  | maxIndices | The maximum number of indices to include in one packing map. Generally, this number would be 2^16-1.
  | maxVertices | The maximum number of vertices to include in one packing map. Generally, this number would also be 2^16-1.
  | inIndices | The input unique index data.
  | outIndices | The resulting indices.
  | outPackingMap | The packing maps. These maps are used to identify
  | outNVertices | The number of vertices for each split packing map.
Returns: The number of indices packed away.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::PackVertexBufferColor | ( | uint8 * | destBuffer,
|  | uint32 | destBuffStride,
|  | const FCDGeometrySource * | source,
|  | uint32 | vCount,
|  | uint16 * | vtxPackingMap,
|  | const FCDGeometryIndexTranslationMap & | translationMap
| ) |

  | Used to pack a vertex buffer object object with 4 bytes color data. Parameters:
  | destBuffer | The vertex buffer memory.
  | destBufferStride | The size of one vertex in the vertex buffer.
  | source | The original mesh vertex data.
  | vCount | The number of vertex elements in the original mesh vertex data.
  | vtxPackingMap | The packing map, generated by GenerateVertexPackingMap, for this vertex data.
  | translationMap | The translation map, generated by GenerateUniqueIndices, for this vertex data.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::PackVertexBufferV2 | ( | uint8 * | destBuffer,
|  | uint32 | destBuffStride,
|  | const FCDGeometrySource * | source,
|  | uint32 | vCount,
|  | uint16 * | vtxPackingMap,
|  | const FCDGeometryIndexTranslationMap & | translationMap
| ) |

  | Used to pack a vertex buffer object object with 2D float vertex data. Parameters:
  | destBuffer | The vertex buffer memory.
  | destBufferStride | The size of one vertex in the vertex buffer.
  | source | The original mesh vertex data.
  | vCount | The number of vertex elements in the original mesh vertex data.
  | vtxPackingMap | The packing map, generated by GenerateVertexPackingMap, for this vertex data.
  | translationMap | The translation map, generated by GenerateUniqueIndices, for this vertex data.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::PackVertexBufferV3 | ( | uint8 * | destBuffer,
|  | uint32 | destBuffStride,
|  | const FCDGeometrySource * | source,
|  | uint32 | vCount,
|  | uint16 * | vtxPackingMap,
|  | const FCDGeometryIndexTranslationMap & | translationMap
| ) |

  | Used to pack a vertex buffer object with 3D float vertex data. Parameters:
  | destBuffer | The vertex buffer memory.
  | destBufferStride | The size of one vertex in the vertex buffer.
  | source | The original mesh vertex data.
  | vCount | The number of vertex elements in the original mesh vertex data.
  | vtxPackingMap | The packing map, generated by GenerateVertexPackingMap, for this vertex data.
  | translationMap | The translation map, generated by GenerateUniqueIndices, for this vertex data.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::ReverseNormals | ( | FCDGeometryMesh * | mesh | ) |

  | Reverses all the normals of a mesh. Since they are related to normals, this function also reverses geometric tangents and binormals as well as texture tangents and binormals. Parameters:
  | mesh | The mesh to process.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::RevertUniqueIndices | ( | const FCDGeometryPolygonsInput & | inSrc,
|  | FCDGeometryPolygonsInput & | outSrc,
|  | const FCDGeometryIndexTranslationMap & | translationMap
| ) |

  | Reverts the modifications done when applying the unique index buffer data translation unto some polygons input. IMPORTANT: this function is un-tested, DO NOT USE. Parameters:
  | inSrc | ?
  | outSrc | ?
  | translationMap | ?

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::Triangulate | ( | FCDGeometryPolygons * | polygons,
|  | bool | recalculate = `true`
| ) |

  | Triangulates a polygons set. Parameters:
  | polygons | The polygons set to triangulate.
  | recalculate | Whether the statistics of the mesh should be recalculated after the tool has completed.

FCOLLADA_EXPORT void FCDGeometryPolygonsTools::Triangulate | ( | FCDGeometryMesh * | mesh | ) |

  | Triangulates a mesh. Parameters:
  | mesh | The mesh to triangulate.