Triangle mesh collision shape. More...

Data Structures | |
| struct | b3MeshDef |
| This is used to create a re-usable collision mesh. More... | |
| struct | b3MeshTriangle |
| A mesh triangle. More... | |
| struct | b3MeshNode |
| A mesh BVH node. More... | |
| struct | b3MeshData |
| This is a sorted triangle collision bounding volume hierarchy. More... | |
| struct | b3Mesh |
| This allows mesh data to be re-used with different scales. More... | |
| union | b3MeshNode.data |
| Anonymous union. More... | |
| struct | b3MeshNode.data.asNode |
| Internal node. More... | |
| struct | b3MeshNode.data.asLeaf |
| Leaf node. More... | |
Macros | |
| #define | B3_MESH_VERSION 0xABD11AB62A6E886Dull |
| 64-bit mesh version. Useful for validating serialized data. | |
Enumerations | |
| enum | b3MeshEdgeFlags { b3_concaveEdge1 = 0x01 , b3_concaveEdge2 = 0x02 , b3_concaveEdge3 = 0x04 , b3_inverseConcaveEdge1 = 0x10 , b3_inverseConcaveEdge2 = 0x20 , b3_inverseConcaveEdge3 = 0x40 , b3_allConcaveEdges = b3_concaveEdge1 | b3_concaveEdge2 | b3_concaveEdge3 , b3_flatEdge1 = b3_concaveEdge1 | b3_inverseConcaveEdge1 , b3_flatEdge2 = b3_concaveEdge2 | b3_inverseConcaveEdge2 , b3_flatEdge3 = b3_concaveEdge3 | b3_inverseConcaveEdge3 , b3_allFlatEdges = b3_flatEdge1 | b3_flatEdge2 | b3_flatEdge3 } |
| Triangle mesh edge flags. | |
Functions | |
| const b3MeshNode * | b3GetMeshNodes (const b3MeshData *mesh) |
| Get read only mesh BVH nodes. | |
| const b3Vec3 * | b3GetMeshVertices (const b3MeshData *mesh) |
| Get read only mesh vertices. | |
| const b3MeshTriangle * | b3GetMeshTriangles (const b3MeshData *mesh) |
| Get read only mesh triangles. | |
| const uint8_t * | b3GetMeshMaterialIndices (const b3MeshData *mesh) |
| Get read only mesh materials. The count is equal to the triangle count. | |
| const uint8_t * | b3GetMeshFlags (const b3MeshData *mesh) |
| Get read only mesh flags. The count is equal to the triangle count. | |
| b3MeshData * | b3CreateGridMesh (int xCount, int zCount, float cellWidth, int materialCount, bool identifyEdges) |
| Create a grid mesh along the x and z axes. | |
| b3MeshData * | b3CreateWaveMesh (int xCount, int zCount, float cellWidth, float amplitude, float rowFrequency, float columnFrequency) |
| Create a wave mesh along the x and z axes. | |
| b3MeshData * | b3CreateTorusMesh (int radialResolution, int tubularResolution, float radius, float thickness) |
| Create a torus mesh. | |
| b3MeshData * | b3CreateBoxMesh (b3Vec3 center, b3Vec3 extent, bool identifyEdges) |
| Create a box mesh. | |
| b3MeshData * | b3CreateHollowBoxMesh (b3Vec3 center, b3Vec3 extent) |
| Create a hollow box mesh. | |
| b3MeshData * | b3CreatePlatformMesh (b3Vec3 center, float height, float topWidth, float bottomWidth) |
| Create a platform mesh. A truncated pyramid. | |
| b3MeshData * | b3CreateMesh (const b3MeshDef *def, int *degenerateTriangleIndices, int degenerateCapacity) |
| Create a generic mesh. | |
| void | b3DestroyMesh (b3MeshData *mesh) |
| Destroy a mesh. | |
| int | b3GetHeight (const b3MeshData *mesh) |
| Get the height of the mesh BVH. | |
Triangle mesh collision shape.
| struct b3MeshDef |
This is used to create a re-usable collision mesh.

| Data Fields | ||
|---|---|---|
| bool | identifyEdges | Compute triangle adjacency information using shared edges. |
| int32_t * | indices | Triangle vertex indices. 3 for each triangle. |
| uint8_t * | materialIndices |
Triangle material index. 1 per triangle. Indexes into b3ShapeDef::materials. This allows different run-time material data to be associated with different instances of this mesh. |
| int | triangleCount | The triangle count. Must be 1 or more. |
| bool | useMedianSplit |
Use the median split instead of SAH to speed up mesh creation. Good for meshes that are structured like a grid. |
| int | vertexCount | The vertex count. Must be 3 or more. |
| b3Vec3 * | vertices | Triangle vertices. |
| float | weldTolerance | Tolerance for vertex welding in length units. |
| bool | weldVertices | Optionally weld nearby vertices. |
| struct b3MeshTriangle |
| struct b3MeshData |
This is a sorted triangle collision bounding volume hierarchy.

| Data Fields | ||
|---|---|---|
| b3AABB | bounds | Local axis-aligned box. |
| int | byteCount | The total number of bytes for this mesh. |
| int | degenerateCount | The number of degenerate triangles. Diagnostic. |
| int | flagsOffset | Offset of the triangle flag array in bytes from the struct address. |
| uint32_t | hash | Hash of this mesh (this field is zero when the hash is computed). |
| int | materialCount | The number of materials. |
| int | materialOffset | Offset of the material array in bytes from the struct address. |
| int | nodeCount | The number of BVH nodes. |
| int | nodeOffset | Offset of the node array in bytes from the struct address. |
| float | surfaceArea | Combined surface area of all triangles. Single-sided. |
| int | treeHeight | The height of the bounding volume hierarchy. |
| int | triangleCount | The number of triangles. |
| int | triangleOffset | Offset of the triangle array in bytes from the struct address. |
| uint64_t | version | Version must be first. |
| int | vertexCount | The number of vertices. |
| int | vertexOffset | Offset of the vertex array in bytes from the struct address. |
| struct b3Mesh |
This allows mesh data to be re-used with different scales.

| Data Fields | ||
|---|---|---|
| const b3MeshData * | data | Immutable pointer to the mesh data. |
| b3Vec3 | scale |
This scale may be non-uniform and have negative components. However, no component may be very small in magnitude. |
| struct b3MeshNode.data.asNode |
| struct b3MeshNode.data.asLeaf |
| b3MeshData * b3CreateGridMesh | ( | int | xCount, |
| int | zCount, | ||
| float | cellWidth, | ||
| int | materialCount, | ||
| bool | identifyEdges ) |
Create a grid mesh along the x and z axes.
| xCount | the number of rows in the x direction |
| zCount | the number of rows in the z direction |
| cellWidth | the width of each cell |
| materialCount | the number of materials to generate |
| identifyEdges | compute adjacency information |