MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / getVertexIndexInFace

Method getVertexIndexInFace

src/collision/PolygonVertexArray.cpp:83–105  ·  view source on GitHub ↗

Return the vertex index of a given vertex in a face * @return The index of a vertex (in the array of vertices data) of a given vertex in a face */

Source from the content-addressed store, hash-verified

81 * @return The index of a vertex (in the array of vertices data) of a given vertex in a face
82 */
83uint32 PolygonVertexArray::getVertexIndexInFace(uint32 faceIndex32, uint32 noVertexInFace) const {
84
85 assert(faceIndex32 < mNbFaces);
86
87 // Get the face
88 PolygonFace* face = getPolygonFace(faceIndex32);
89
90 assert(noVertexInFace < face->nbVertices);
91
92 const void* vertexIndexPointer = mIndicesStart + (face->indexBase + noVertexInFace) * mIndicesStride;
93
94 if (mIndexDataType == PolygonVertexArray::IndexDataType::INDEX_INTEGER_TYPE) {
95 return *((uint*)vertexIndexPointer);
96 }
97 else if (mIndexDataType == PolygonVertexArray::IndexDataType::INDEX_SHORT_TYPE) {
98 return *((unsigned short*)vertexIndexPointer);
99 }
100 else {
101 assert(false);
102 }
103
104 return 0;
105}
106
107// Return the coordinates of a given vertex
108Vector3 PolygonVertexArray::getVertex(uint32 vertexIndex) const {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected