Skip to content

Commit

Permalink
try 02
Browse files Browse the repository at this point in the history
  • Loading branch information
erincatto committed Aug 27, 2024
1 parent 570373f commit d7ab203
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions samples/sample_determinism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,27 @@ class FallingHinges : public Sample
}
}

if (sleeping == true)
//if (sleeping == true)
{
m_hash = B2_HASH_INIT;
uint32_t hash = B2_HASH_INIT;
for ( int i = 0; i < bodyCount; ++i )
{
b2Transform xf = b2Body_GetTransform( m_bodies[i] );
printf( "%d %.9f %.9f %.9f %.9f\n", i, xf.p.x, xf.p.y, xf.q.c, xf.q.s );
m_hash = b2Hash( m_hash, reinterpret_cast<uint8_t*>( &xf ), sizeof( b2Transform ) );
//printf( "%d %.9f %.9f %.9f %.9f\n", i, xf.p.x, xf.p.y, xf.q.c, xf.q.s );
hash = b2Hash( hash, reinterpret_cast<uint8_t*>( &xf ), sizeof( b2Transform ) );
}

m_sleepStep = m_stepCount - 1;
printf( "step = %d, hash = 0x%08x\n", m_sleepStep, m_hash );
if (sleeping == true)
{
m_sleepStep = m_stepCount - 1;
m_hash = hash;
printf( "sleep step = %d, hash = 0x%08x\n", m_sleepStep, m_hash );
}
else
{
printf( "step = %d, hash = 0x%08x\n", m_stepCount - 1, hash );

}
}
}

Expand Down

0 comments on commit d7ab203

Please sign in to comment.