simplify
This commit is contained in:
parent
f533aa5a70
commit
f0ed536b39
9 changed files with 218 additions and 94 deletions
|
|
@ -38,7 +38,7 @@ static const PeelPreset s_peelPresets[GHOST_PEEL_PRESET_COUNT] = {
|
|||
};
|
||||
|
||||
const char* g_ghostSceneNames[e_ghostSceneCount] = {
|
||||
"Flat", "Concave", "Cliff", "Crest", "Bumps", "T-Junction", "Internal", "Chamfer", "Rail",
|
||||
"Flat", "Concave", "Cliff", "Crest", "Bumps", "Internal", "Chamfer", "Rail",
|
||||
};
|
||||
|
||||
const char* g_ghostBodyNames[e_ghostBodyCount] = { "Box", "H Capsule", "V Capsule", "Sphere", "Cylinder" };
|
||||
|
|
@ -484,8 +484,6 @@ void CreateGhostGround( b3WorldId worldId, GhostCollisionsData* data )
|
|||
}
|
||||
|
||||
MeshBuilder builder = { 0 };
|
||||
b3Vec2 left[2] = { { -h, 0.0f }, { 0.0f, 0.0f } };
|
||||
b3Vec2 right[2] = { { 0.0f, 0.0f }, { h, 0.0f } };
|
||||
float cellSize = settings->cellSize;
|
||||
bool mirror = settings->mirror;
|
||||
float groundHalfWidth = GHOST_HALF_WIDTH;
|
||||
|
|
@ -493,13 +491,7 @@ void CreateGhostGround( b3WorldId worldId, GhostCollisionsData* data )
|
|||
|
||||
if ( settings->heightField )
|
||||
{
|
||||
if ( settings->scene == e_ghostTJunction )
|
||||
{
|
||||
AddHeightField( worldId, data, -h, 0.0f, GetCellCount( h, cellSize ), groundHalfWidth,
|
||||
GetCellCount( 2.0f * groundHalfWidth, 0.5f * cellSize ), false );
|
||||
AddHeightField( worldId, data, 0.0f, h, GetCellCount( h, cellSize ), groundHalfWidth, cellCountZ, false );
|
||||
}
|
||||
else if ( settings->scene == e_ghostInternal )
|
||||
if ( settings->scene == e_ghostInternal )
|
||||
{
|
||||
// One grid line per profile row, as in the mesh
|
||||
PeelPreset preset = s_peelPresets[settings->peelPreset];
|
||||
|
|
@ -529,13 +521,6 @@ void CreateGhostGround( b3WorldId worldId, GhostCollisionsData* data )
|
|||
AddRail( &builder, data->profile, data->profileCount, cellSize, mirror );
|
||||
AddMesh( data, &builder, false );
|
||||
}
|
||||
else if ( settings->scene == e_ghostTJunction )
|
||||
{
|
||||
// Fine and coarse strips share only every other vertex along x = 0
|
||||
AddStrip( &builder, left, 2, cellSize, 0.5f * cellSize, mirror );
|
||||
AddStrip( &builder, right, 2, cellSize, cellSize, mirror );
|
||||
AddMesh( data, &builder, false );
|
||||
}
|
||||
else if ( settings->scene == e_ghostInternal )
|
||||
{
|
||||
// The mesh has no friction and the ground plane under it does, as in PEEL
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ typedef enum GhostScene
|
|||
e_ghostCliff,
|
||||
e_ghostCrest,
|
||||
e_ghostBumps,
|
||||
e_ghostTJunction,
|
||||
e_ghostInternal,
|
||||
e_ghostChamfer,
|
||||
e_ghostRail,
|
||||
|
|
@ -60,8 +59,7 @@ typedef struct GhostSettings
|
|||
int peelPreset;
|
||||
bool mirror;
|
||||
|
||||
// Build the ground from height fields instead of meshes. Each height field is its own shape, so the
|
||||
// T-junction scene becomes a seam between a fine and a coarse tile.
|
||||
// Build the ground from height fields instead of meshes. Each height field is its own shape.
|
||||
bool heightField;
|
||||
|
||||
float cellSize;
|
||||
|
|
|
|||
Loading…
Reference in a new issue