quantized neighbor normals

This commit is contained in:
Erin Catto 2026-10-30 15:37:39 -07:00
commit 3b4878b7f2
5 changed files with 331 additions and 5 deletions

View file

@ -342,6 +342,17 @@ B3_INLINE const uint8_t* b3GetMeshFlags( const b3MeshData* mesh )
return (const uint8_t*)( (intptr_t)mesh + mesh->flagsOffset );
}
// Get read only quantized angles between neighboring triangle normals.
B3_INLINE const int8_t* b3GetMeshEdgeAngles( const b3MeshData* mesh )
{
if ( mesh->edgeAngleOffset == 0 )
{
return NULL;
}
return (const int8_t*)( (intptr_t)mesh + mesh->edgeAngleOffset );
}
/// 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

@ -2260,7 +2260,7 @@ typedef struct b3MeshDef
} b3MeshDef;
/// 64-bit mesh version. Useful for validating serialized data.
#define B3_MESH_VERSION 0xAAAB9A00F1A8AAF7ull
#define B3_MESH_VERSION 0x5DDAD5A2B47BACA5ull
/// Triangle mesh edge flags.
typedef enum b3MeshEdgeFlags
@ -2291,6 +2291,9 @@ typedef struct b3MeshTriangle
int32_t index3; ///< Index of vertex 3.
} b3MeshTriangle;
// Indicates an isolated edge.
#define B3_BOUNDARY_EDGE_ANGLE ( -128 )
/// A mesh BVH node.
typedef struct b3MeshNode
{
@ -2379,8 +2382,8 @@ typedef struct b3MeshData
/// Offset of the triangle flag array in bytes from the struct address.
int32_t flagsOffset;
/// Explicit padding.
int32_t padding;
// Offset to the array of neighbor quantized normal offsets.
int32_t edgeAngleOffset;
} b3MeshData;
/// This allows mesh data to be re-used with different scales.