Remove compound mesh child material limit. (#172)
This commit is contained in:
parent
adec25b301
commit
5643cd81ff
11 changed files with 314 additions and 58 deletions
|
|
@ -2481,11 +2481,7 @@ typedef struct b3CompoundDef
|
|||
} b3CompoundDef;
|
||||
|
||||
/// The baked compound version depends on the tree, mesh, and hull versions.
|
||||
#define B3_COMPOUND_VERSION ( 0xB11DCE70FAD5622Bull ^ B3_DYNAMIC_TREE_VERSION ^ B3_MESH_VERSION ^ B3_HULL_VERSION )
|
||||
|
||||
/// Meshes used in compounds have limited space for materials. If you have
|
||||
/// a mesh with many materials, you can use it outside of the compound.
|
||||
#define B3_MAX_COMPOUND_MESH_MATERIALS 4
|
||||
#define B3_COMPOUND_VERSION ( 0x7A2F41C9E6D0B358ull ^ B3_DYNAMIC_TREE_VERSION ^ B3_MESH_VERSION ^ B3_HULL_VERSION )
|
||||
|
||||
/// The data for a baked compound shape. This is a potentially large yet highly optimized
|
||||
/// data structure. It can contain thousands of child shapes, yet at runtime it populates
|
||||
|
|
@ -2556,7 +2552,10 @@ typedef struct b3CompoundCapsule
|
|||
b3Capsule capsule;
|
||||
|
||||
/// Index to a shared material.
|
||||
int materialIndex;
|
||||
uint16_t materialIndex;
|
||||
|
||||
/// Padding for determinism.
|
||||
uint16_t padding;
|
||||
} b3CompoundCapsule;
|
||||
|
||||
/// A hull that lives in a compound.
|
||||
|
|
@ -2569,7 +2568,10 @@ typedef struct b3CompoundHull
|
|||
b3Transform transform;
|
||||
|
||||
/// Index to a shared material.
|
||||
int materialIndex;
|
||||
uint16_t materialIndex;
|
||||
|
||||
/// Padding for determinism.
|
||||
uint16_t padding;
|
||||
} b3CompoundHull;
|
||||
|
||||
/// A mesh with non-uniform scale that lives in a compound.
|
||||
|
|
@ -2585,10 +2587,12 @@ typedef struct b3CompoundMesh
|
|||
b3Vec3 scale;
|
||||
|
||||
/// This is used to access the surface material from b3GetCompoundMaterials.
|
||||
/// Requires an extra level of indirection. The triangle material index
|
||||
/// is clamped to B3_MAX_COMPOUND_MESH_MATERIALS.
|
||||
/// Requires an extra level of indirection.
|
||||
/// materialIndex = materialIndices[triangle->materialIndex]
|
||||
int materialIndices[B3_MAX_COMPOUND_MESH_MATERIALS];
|
||||
const uint16_t* materialIndices;
|
||||
|
||||
/// The number of materials. 1 for convex hapes.
|
||||
int materialCount;
|
||||
} b3CompoundMesh;
|
||||
|
||||
/// A sphere that lives in a compound.
|
||||
|
|
@ -2598,7 +2602,10 @@ typedef struct b3CompoundSphere
|
|||
b3Sphere sphere;
|
||||
|
||||
/// Index to a shared material.
|
||||
int materialIndex;
|
||||
uint16_t materialIndex;
|
||||
|
||||
/// Padding for determinism.
|
||||
uint16_t padding;
|
||||
} b3CompoundSphere;
|
||||
|
||||
/// Child shape of a compound
|
||||
|
|
@ -2617,8 +2624,11 @@ typedef struct b3ChildShape
|
|||
b3Transform transform;
|
||||
|
||||
/// Material indices. Index 0 is used for convex shapes.
|
||||
/// todo limit to 64K?
|
||||
int materialIndices[B3_MAX_COMPOUND_MESH_MATERIALS];
|
||||
const uint16_t* materialIndices;
|
||||
|
||||
/// The number of materials. This is one for convex shapes. For
|
||||
/// meshes it is determined by the maximum triangle material index.
|
||||
int materialCount;
|
||||
|
||||
/// The shape type (union tag).
|
||||
b3ShapeType type;
|
||||
|
|
|
|||
Loading…
Reference in a new issue