New sample renderer and UI (#10)

No changes to simulation
This commit is contained in:
Erin Catto 2026-06-06 10:06:05 -07:00 • committed by GitHub
commit 9e02b7f3b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
196 changed files with 116992 additions and 29969 deletions

View file

@ -18,6 +18,18 @@
#define BENCHMARK_DEBUG 1
#endif
static b3ShapeId g_groundShapeId = { 0 };
b3ShapeId GetGroundShapeId( void )
{
return g_groundShapeId;
}
void ResetGroundShapeId( void )
{
g_groundShapeId = b3_nullShapeId;
}
void CreateJointGrid( b3WorldId worldId )
{
b3World_EnableSleeping( worldId, false );
@ -94,12 +106,12 @@ void CreateLargePyramid( b3WorldId worldId )
{
b3BodyDef bodyDef = b3DefaultBodyDef();
bodyDef.position = (b3Vec3){ 0.0f, -1.0f };
bodyDef.position = (b3Vec3){ 0.0f, -1.0f, 0.0f };
b3BodyId groundId = b3CreateBody( worldId, &bodyDef );
b3BoxHull box = b3MakeBoxHull( 100.0f, 1.0f, 100.0f );
b3ShapeDef shapeDef = b3DefaultShapeDef();
b3CreateHullShape( groundId, &shapeDef, &box.base );
g_groundShapeId = b3CreateHullShape( groundId, &shapeDef, &box.base );
}
b3BodyDef bodyDef = b3DefaultBodyDef();
@ -133,12 +145,12 @@ void CreateWidePyramid( b3WorldId worldId )
{
{
b3BodyDef bodyDef = b3DefaultBodyDef();
bodyDef.position = (b3Vec3){ 0.0f, -1.0f };
bodyDef.position = (b3Vec3){ 0.0f, -1.0f, 0.0f };
b3BodyId groundId = b3CreateBody( worldId, &bodyDef );
b3BoxHull box = b3MakeBoxHull( 100.0f, 1.0f, 100.0f );
b3ShapeDef shapeDef = b3DefaultShapeDef();
b3CreateHullShape( groundId, &shapeDef, &box.base );
g_groundShapeId = b3CreateHullShape( groundId, &shapeDef, &box.base );
}
const float boxSize = 2.0f;
@ -178,6 +190,7 @@ static void CreateSmallPyramid( b3WorldId worldId, int baseCount, float extent,
bodyDef.enableSleep = false;
b3ShapeDef shapeDef = b3DefaultShapeDef();
shapeDef.density = 100.0f;
b3BoxHull box = b3MakeBoxHull( extent, extent, extent );
@ -210,9 +223,8 @@ void CreateManyPyramids( b3WorldId worldId )
b3BodyId groundId = b3CreateBody( worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
b3BoxHull box = b3MakeBoxHull( groundExtent, 1.0f, groundExtent );
b3CreateHullShape( groundId, &shapeDef, &box.base );
g_groundShapeId = b3CreateHullShape( groundId, &shapeDef, &box.base );
}
float baseWidth = 2.0f * extent * baseCount;
@ -532,7 +544,7 @@ void CreateWasher( b3WorldId worldId )
b3BoxHull box = b3MakeBoxHull( 60.0f, 1.0f, 60.0f );
b3ShapeDef shapeDef = b3DefaultShapeDef();
b3CreateHullShape( groundId, &shapeDef, &box.base );
g_groundShapeId = b3CreateHullShape( groundId, &shapeDef, &box.base );
}
{
@ -794,7 +806,7 @@ void CreateJunkyard( b3WorldId worldId )
b3ShapeDef shapeDef = b3DefaultShapeDef();
{
b3BoxHull box = b3MakeBoxHull( 120.0f, 1.0f, 120.0f );
b3CreateHullShape( groundId, &shapeDef, &box.base );
g_groundShapeId = b3CreateHullShape( groundId, &shapeDef, &box.base );
}
{
b3Vec3 offset = { -50.0f, 8.0f, 0.0f };