ReactPhysics3D
v0.10.2
C++ Physics engine library
|
This class is used to describe the vertices and faces of a triangular mesh. More...
#include <include/reactphysics3d/collision/TriangleVertexArray.h>
Public Types | |
enum class | VertexDataType { VERTEX_FLOAT_TYPE , VERTEX_DOUBLE_TYPE } |
Data type for the vertices in the array. | |
enum class | NormalDataType { NORMAL_FLOAT_TYPE , NORMAL_DOUBLE_TYPE } |
Data type for the vertex normals in the array. | |
enum class | IndexDataType { INDEX_INTEGER_TYPE , INDEX_SHORT_TYPE } |
Data type for the indices in the array. | |
Public Member Functions | |
TriangleVertexArray (uint32 nbVertices, const void *verticesStart, uint32 verticesStride, uint32 nbTriangles, const void *indexesStart, uint32 indexesStride, VertexDataType vertexDataType, IndexDataType indexDataType) | |
Constructor without vertices normals. | |
TriangleVertexArray (uint32 nbVertices, const void *verticesStart, uint32 verticesStride, const void *verticesNormalsStart, uint32 uverticesNormalsStride, uint32 nbTriangles, const void *indexesStart, uint32 indexesStride, VertexDataType vertexDataType, NormalDataType normalDataType, IndexDataType indexDataType) | |
Constructor with vertices normals. | |
TriangleVertexArray & | operator= (const TriangleVertexArray &triangleVertexArray)=delete |
Deleted assignment operator. | |
TriangleVertexArray (const TriangleVertexArray &triangleVertexArray)=delete | |
Deleted copy-constructor. | |
VertexDataType | getVertexDataType () const |
Return the vertex data type. | |
NormalDataType | getVertexNormalDataType () const |
Return the vertex normal data type. | |
bool | getHasNormals () const |
Return true if the vertices normal have been provided by the user. | |
IndexDataType | getIndexDataType () const |
Return the index data type. | |
uint32 | getNbVertices () const |
Return the number of vertices. | |
uint32 | getNbTriangles () const |
Return the number of triangles. | |
uint32 | getVerticesStride () const |
Return the vertices stride (number of bytes) | |
uint32 | getVerticesNormalsStride () const |
Return the vertex normals stride (number of bytes) | |
uint32 | getIndicesStride () const |
Return the indices stride (number of bytes) | |
const void * | getVerticesStart () const |
Return the pointer to the start of the vertices array. | |
const void * | getVerticesNormalsStart () const |
Return the pointer to the start of the vertex normals array. | |
const void * | getIndicesStart () const |
Return the pointer to the start of the indices array. | |
void | getTriangleVerticesIndices (uint32 triangleIndex, uint32 &outV1Index, uint32 &outV2Index, uint32 &outV3Index) const |
Return the three vertex indices of a given triangle face. | |
Vector3 | getVertex (uint32 vertexIndex) const |
Return a vertex of the array. | |
Vector3 | getVertexNormal (uint32 vertexIndex) const |
Return a vertex normal of the array. | |
This class is used to describe the vertices and faces of a triangular mesh.
A TriangleVertexArray represents a continuous array of vertices and indexes of a triangular mesh. When you create a TriangleVertexArray, no data is copied into the array. It only stores pointer to the data. part. Therefore, make sure that the data pointed by a TriangleVertexArray remains valid during the TriangleVertexArray life.
TriangleVertexArray::TriangleVertexArray | ( | uint32 | nbVertices, |
const void * | verticesStart, | ||
uint32 | verticesStride, | ||
uint32 | nbTriangles, | ||
const void * | indexesStart, | ||
uint32 | indexesStride, | ||
VertexDataType | vertexDataType, | ||
IndexDataType | indexDataType | ||
) |
Constructor without vertices normals.
Note that your data will not be copied into the TriangleVertexArray and therefore, you need to make sure that those data are always valid during the lifetime of the TriangleVertexArray.
With this constructor, you do not need to provide vertices normals for smooth mesh collision. Therefore, the vertices normals will be computed automatically. The vertices normals are computed with weighted average of the associated triangle face normal. The weights are the angle between the associated edges of neighbor triangle face.
nbVertices | Number of vertices in the array |
verticesStart | Pointer to the first vertices of the array |
verticesStride | Number of bytes between the beginning of two consecutive vertices |
nbTriangles | Number of triangles in the array |
indexesStart | Pointer to the first triangle index |
indexesStride | Number of bytes between the beginning of the three indices of two triangles |
vertexDataType | Type of data for the vertices (float, double) |
indexDataType | Type of data for the indices (short, int) |
TriangleVertexArray::TriangleVertexArray | ( | uint32 | nbVertices, |
const void * | verticesStart, | ||
uint32 | verticesStride, | ||
const void * | verticesNormalsStart, | ||
uint32 | verticesNormalsStride, | ||
uint32 | nbTriangles, | ||
const void * | indexesStart, | ||
uint32 | indexesStride, | ||
VertexDataType | vertexDataType, | ||
NormalDataType | normalDataType, | ||
IndexDataType | indexDataType | ||
) |
Constructor with vertices normals.
Note that your data will not be copied into the TriangleVertexArray and therefore, you need to make sure that those data are always valid during the lifetime of the TriangleVertexArray.
With this constructor, you need to provide the vertices normals that will be used for smooth mesh collision.
nbVertices | Number of vertices in the array |
verticesStart | Pointer to the first vertices of the array |
verticesStride | Number of bytes between the beginning of two consecutive vertices |
verticesNormalsStart | Pointer to the first vertex normal of the array |
verticesNormalsStride | Number of bytes between the beginning of two consecutive vertex normals |
nbTriangles | Number of triangles in the array |
indexesStart | Pointer to the first triangle index |
indexesStride | Number of bytes between the beginning of two consecutive triangle indices |
vertexDataType | Type of data for the vertices (float, double) |
normalDataType | Type of data for the normals (float, double) |
indexDataType | Type of data for the indices (short, int) |
RP3D_FORCE_INLINE bool reactphysics3d::TriangleVertexArray::getHasNormals | ( | ) | const |
Return true if the vertices normal have been provided by the user.
RP3D_FORCE_INLINE TriangleVertexArray::IndexDataType reactphysics3d::TriangleVertexArray::getIndexDataType | ( | ) | const |
Return the index data type.
RP3D_FORCE_INLINE const void * reactphysics3d::TriangleVertexArray::getIndicesStart | ( | ) | const |
Return the pointer to the start of the indices array.
RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleVertexArray::getIndicesStride | ( | ) | const |
Return the indices stride (number of bytes)
RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleVertexArray::getNbTriangles | ( | ) | const |
Return the number of triangles.
RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleVertexArray::getNbVertices | ( | ) | const |
Return the number of vertices.
void TriangleVertexArray::getTriangleVerticesIndices | ( | uint32 | triangleIndex, |
uint32 & | outV1Index, | ||
uint32 & | outV2Index, | ||
uint32 & | outV3Index | ||
) | const |
Return the three vertex indices of a given triangle face.
triangleIndex | Index of a given triangle in the array | |
[out] | outV1Index | Index of the first vertex of the triangle in the vertex array |
[out] | outV2Index | Index of the first vertex of the triangle in the vertex array |
[out] | outV3Index | Index of the first vertex of the triangle in the vertex array |
Vector3 TriangleVertexArray::getVertex | ( | uint32 | vertexIndex | ) | const |
Return a vertex of the array.
vertexIndex | Index of a given vertex of the array |
RP3D_FORCE_INLINE TriangleVertexArray::VertexDataType reactphysics3d::TriangleVertexArray::getVertexDataType | ( | ) | const |
Return the vertex data type.
Vector3 TriangleVertexArray::getVertexNormal | ( | uint32 | vertexIndex | ) | const |
Return a vertex normal of the array.
vertexIndex | Index of a given vertex of the array |
RP3D_FORCE_INLINE TriangleVertexArray::NormalDataType reactphysics3d::TriangleVertexArray::getVertexNormalDataType | ( | ) | const |
Return the vertex normal data type.
RP3D_FORCE_INLINE const void * reactphysics3d::TriangleVertexArray::getVerticesNormalsStart | ( | ) | const |
Return the pointer to the start of the vertex normals array.
RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleVertexArray::getVerticesNormalsStride | ( | ) | const |
Return the vertex normals stride (number of bytes)
RP3D_FORCE_INLINE const void * reactphysics3d::TriangleVertexArray::getVerticesStart | ( | ) | const |
Return the pointer to the start of the vertices array.
RP3D_FORCE_INLINE uint32 reactphysics3d::TriangleVertexArray::getVerticesStride | ( | ) | const |
Return the vertices stride (number of bytes)