improve vertex handling

This commit is contained in:
Erin Catto 2026-11-01 22:48:05 -08:00
commit 1170814dee
11 changed files with 523 additions and 43 deletions

View file

@ -353,6 +353,17 @@ B3_INLINE const int8_t* b3GetMeshEdgeAngles( const b3MeshData* mesh )
return (const int8_t*)( (intptr_t)mesh + mesh->edgeAngleOffset );
}
// Get read only vertex flags.
B3_INLINE const uint8_t* b3GetMeshVertexFlags( const b3MeshData* mesh )
{
if ( mesh->vertexFlagOffset == 0 )
{
return NULL;
}
return (const uint8_t*)( (intptr_t)mesh + mesh->vertexFlagOffset );
}
/// Create a grid mesh along the x and z axes.
/// @param xCount the number of rows in the x direction
/// @param zCount the number of rows in the z direction

View file

@ -2294,6 +2294,13 @@ typedef struct b3MeshTriangle
// Indicates an isolated edge.
#define B3_BOUNDARY_EDGE_ANGLE ( -128 )
// Mesh vertex flags. Used for ghost collision handling.
typedef enum b3MeshVertexFlags
{
b3_flatVertex = 0x01,
b3_concaveVertex = 0x02,
} b3MeshVertexFlags;
/// A mesh BVH node.
typedef struct b3MeshNode
{
@ -2384,6 +2391,9 @@ typedef struct b3MeshData
// Offset to the array of neighbor quantized normal offsets.
int32_t edgeAngleOffset;
/// Offset of the vertex flag array in bytes from the struct address.
int32_t vertexFlagOffset;
} b3MeshData;
/// This allows mesh data to be re-used with different scales.