|
void | Interleave (size_t count, size_t datumSize0, size_t datumSize1, void *const data0, void *const data1, void *__restrict outData) |
| Interleave vertex attribute data. More...
|
|
template<typename T > |
void | QuadToTriangleIndices (size_t quadCount, const T in[], T out[]) |
| Convert quad indices to triangle indices. More...
|
|
template void | QuadToTriangleIndices< uint8_t > (size_t quadCount, const uint8_t in[], uint8_t out[]) |
|
template void | QuadToTriangleIndices< uint16_t > (size_t quadCount, const uint16_t in[], uint16_t out[]) |
|
template void | QuadToTriangleIndices< uint32_t > (size_t quadCount, const uint32_t in[], uint32_t out[]) |
|
void | Scale (Mesh &mesh, float scaleFactor) |
| Scale mesh by a given factor. More...
|
|
Vector3 | TriangleNormal (const Vector3 &p1, const Vector3 &p2, const Vector3 &p3) |
| Calculate normal for triangle. More...
|
|
std::vector< Vector3 > | IndexedTriangleNormals (const std::vector< Vector3 > &positions, const int triangleIndices[], size_t triangleCount) |
| Calculate normals for triangles defined by vertex positions and indices. More...
|
|
std::vector< int > | TriangleNeighbours (const int triangleIndices[], unsigned int triangleCount) |
| Calculate neighbouring triangles. More...
|
|
void | Transform (Mesh &mesh, const Matrix4 &transform) |
| Transform mesh data by a matrix. More...
|
|
void | ReducePrecision (Mesh &mesh) |
| Use half floats or integer types where appropriate. More...
|
|
template<class Attribute0 , class Attribute1 > |
void | SeparateToUnifiedIndices (size_t numIndices, const uint32_t indices0[], const uint32_t indices1[], size_t numAttributes0, const Attribute0 attributes0[], size_t numAttributes1, const Attribute1 attributes1[], std::vector< uint32_t > &outIndices, std::vector< Attribute0 > &outAttributes0, std::vector< Attribute1 > &outAttributes1) |
| Convert seperate indices as found in OBJ files to unified ones. More...
|
|
template<class Attribute0 , class Attribute1 , class Attribute2 > |
void | SeparateToUnifiedIndices (size_t numIndices, const uint32_t indices0[], const uint32_t indices1[], const uint32_t indices2[], size_t numAttributes0, const Attribute0 attributes0[], size_t numAttributes1, const Attribute1 attributes1[], size_t numAttributes2, const Attribute2 attributes2[], std::vector< uint32_t > &outIndices, std::vector< Attribute0 > &outAttributes0, std::vector< Attribute1 > &outAttributes1, std::vector< Attribute2 > &outAttributes2) |
| Convert seperate indices as found in OBJ files to unified ones. More...
|
|
Various functions for mesh data processing.
template<class Attribute0 , class Attribute1 >
void molecular::util::MeshUtils::SeparateToUnifiedIndices |
( |
size_t |
numIndices, |
|
|
const uint32_t |
indices0[], |
|
|
const uint32_t |
indices1[], |
|
|
size_t |
numAttributes0, |
|
|
const Attribute0 |
attributes0[], |
|
|
size_t |
numAttributes1, |
|
|
const Attribute1 |
attributes1[], |
|
|
std::vector< uint32_t > & |
outIndices, |
|
|
std::vector< Attribute0 > & |
outAttributes0, |
|
|
std::vector< Attribute1 > & |
outAttributes1 |
|
) |
| |
Convert seperate indices as found in OBJ files to unified ones.
In OBJ and COLLADA files, each face has individual indices to the vertex, normal and UV buffers. OpenGL only allows for the same index to each buffer, so this method generates new indices for each combination of vertex and UV indices by duplicating the missing vertex information as required.
Index and vertex data is appended to the output vectors.
- Parameters
-
indices0 | Array with numIndices elements for attribute 0. May be nullptr. |
indices1 | Array with numIndices elements for attribute 1. May be nullptr. |