Fix recording crash on compounds (#181)
This commit is contained in:
parent
f8c4fe83df
commit
003a3f7728
3 changed files with 11 additions and 2 deletions
|
|
@ -1180,7 +1180,7 @@ uint32_t b3RecInternCompound( b3Recording* rec, const b3CompoundData* compound )
|
||||||
memcpy( bytes, compound, (size_t)byteCount );
|
memcpy( bytes, compound, (size_t)byteCount );
|
||||||
// Null the tree node pointer in the copy so the canonical bytes are pointer-free.
|
// Null the tree node pointer in the copy so the canonical bytes are pointer-free.
|
||||||
// b3ConvertBytesToCompound fixes it back on load via nodeOffset.
|
// b3ConvertBytesToCompound fixes it back on load via nodeOffset.
|
||||||
( (b3CompoundData*)bytes )->tree.nodes = NULL;
|
b3ConvertCompoundToBytes( (b3CompoundData*)bytes );
|
||||||
uint64_t h = b3Hash64NonZero( bytes, byteCount );
|
uint64_t h = b3Hash64NonZero( bytes, byteCount );
|
||||||
return b3InternGeometry( &rec->registry, b3_geometryCompound, h, bytes, byteCount );
|
return b3InternGeometry( &rec->registry, b3_geometryCompound, h, bytes, byteCount );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2620,7 +2620,12 @@ static void b3RecSeedKeyframeRegistry( b3RecPlayer* player )
|
||||||
{
|
{
|
||||||
memcpy( copy, slot->bytes, (size_t)slot->byteCount );
|
memcpy( copy, slot->bytes, (size_t)slot->byteCount );
|
||||||
}
|
}
|
||||||
uint64_t h = b3Hash64NonZero( slot->bytes, slot->byteCount );
|
if ( slot->kind == b3_geometryCompound )
|
||||||
|
{
|
||||||
|
// Null the pointers in the compound
|
||||||
|
b3ConvertCompoundToBytes( (b3CompoundData*)copy );
|
||||||
|
}
|
||||||
|
uint64_t h = b3Hash64NonZero( copy, slot->byteCount );
|
||||||
uint32_t id = b3AppendGeometry( reg, slot->kind, h, copy, slot->byteCount );
|
uint32_t id = b3AppendGeometry( reg, slot->kind, h, copy, slot->byteCount );
|
||||||
// Seeding in order without dedup keeps id == slot index.
|
// Seeding in order without dedup keeps id == slot index.
|
||||||
B3_ASSERT( id == (uint32_t)i );
|
B3_ASSERT( id == (uint32_t)i );
|
||||||
|
|
|
||||||
|
|
@ -1645,6 +1645,10 @@ static int AllOps( void )
|
||||||
b3RecPlayer* player = b3CreatePlayer( recData, recSize, 1 );
|
b3RecPlayer* player = b3CreatePlayer( recData, recSize, 1 );
|
||||||
ENSURE( player != NULL );
|
ENSURE( player != NULL );
|
||||||
|
|
||||||
|
// Capture keyframes while every geometry kind is live. The default interval is longer
|
||||||
|
// than this recording.
|
||||||
|
b3RecPlayer_SetKeyframePolicy( player, b3RecPlayer_GetKeyframeBudget( player ), 4 );
|
||||||
|
|
||||||
b3RecPlayerInfo info = b3RecPlayer_GetInfo( player );
|
b3RecPlayerInfo info = b3RecPlayer_GetInfo( player );
|
||||||
b3Vec3 recExtents = b3Sub( info.bounds.upperBound, info.bounds.lowerBound );
|
b3Vec3 recExtents = b3Sub( info.bounds.upperBound, info.bounds.lowerBound );
|
||||||
ENSURE( recExtents.x > 0.0f && recExtents.y > 0.0f );
|
ENSURE( recExtents.x > 0.0f && recExtents.y > 0.0f );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue