|
@@ -22,20 +22,23 @@ void EnhancedInternalEdgeRemovalTest::CreateSlidingObjects(RVec3Arg inStart)
|
|
{
|
|
{
|
|
// Slide the shapes over the grid of boxes
|
|
// Slide the shapes over the grid of boxes
|
|
RVec3 pos = inStart - RVec3(0, 0, 12.0_r);
|
|
RVec3 pos = inStart - RVec3(0, 0, 12.0_r);
|
|
|
|
+ static const char *labels[] = { "Normal", "Enhanced edge removal" };
|
|
for (int enhanced_removal = 0; enhanced_removal < 2; ++enhanced_removal)
|
|
for (int enhanced_removal = 0; enhanced_removal < 2; ++enhanced_removal)
|
|
{
|
|
{
|
|
// A box
|
|
// A box
|
|
BodyCreationSettings box_bcs(new BoxShape(Vec3::sReplicate(2.0f)), pos, Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
BodyCreationSettings box_bcs(new BoxShape(Vec3::sReplicate(2.0f)), pos, Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
box_bcs.mLinearVelocity = Vec3(20, 0, 0);
|
|
box_bcs.mLinearVelocity = Vec3(20, 0, 0);
|
|
box_bcs.mEnhancedInternalEdgeRemoval = enhanced_removal == 1;
|
|
box_bcs.mEnhancedInternalEdgeRemoval = enhanced_removal == 1;
|
|
- mBodyInterface->CreateAndAddBody(box_bcs, EActivation::Activate);
|
|
|
|
|
|
+ BodyID id = mBodyInterface->CreateAndAddBody(box_bcs, EActivation::Activate);
|
|
|
|
+ SetBodyLabel(id, labels[enhanced_removal]);
|
|
pos += RVec3(0, 0, 5.0_r);
|
|
pos += RVec3(0, 0, 5.0_r);
|
|
|
|
|
|
// A sphere
|
|
// A sphere
|
|
BodyCreationSettings sphere_bcs(new SphereShape(2.0f), pos, Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
BodyCreationSettings sphere_bcs(new SphereShape(2.0f), pos, Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
sphere_bcs.mLinearVelocity = Vec3(20, 0, 0);
|
|
sphere_bcs.mLinearVelocity = Vec3(20, 0, 0);
|
|
sphere_bcs.mEnhancedInternalEdgeRemoval = enhanced_removal == 1;
|
|
sphere_bcs.mEnhancedInternalEdgeRemoval = enhanced_removal == 1;
|
|
- mBodyInterface->CreateAndAddBody(sphere_bcs, EActivation::Activate);
|
|
|
|
|
|
+ id = mBodyInterface->CreateAndAddBody(sphere_bcs, EActivation::Activate);
|
|
|
|
+ SetBodyLabel(id, labels[enhanced_removal]);
|
|
pos += RVec3(0, 0, 5.0_r);
|
|
pos += RVec3(0, 0, 5.0_r);
|
|
|
|
|
|
// Compound
|
|
// Compound
|
|
@@ -49,7 +52,8 @@ void EnhancedInternalEdgeRemovalTest::CreateSlidingObjects(RVec3Arg inStart)
|
|
BodyCreationSettings compound_bcs(&compound, pos, Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
BodyCreationSettings compound_bcs(&compound, pos, Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
compound_bcs.mLinearVelocity = Vec3(20, 0, 0);
|
|
compound_bcs.mLinearVelocity = Vec3(20, 0, 0);
|
|
compound_bcs.mEnhancedInternalEdgeRemoval = enhanced_removal == 1;
|
|
compound_bcs.mEnhancedInternalEdgeRemoval = enhanced_removal == 1;
|
|
- mBodyInterface->CreateAndAddBody(compound_bcs, EActivation::Activate);
|
|
|
|
|
|
+ id = mBodyInterface->CreateAndAddBody(compound_bcs, EActivation::Activate);
|
|
|
|
+ SetBodyLabel(id, labels[enhanced_removal]);
|
|
pos += RVec3(0, 0, 7.0_r);
|
|
pos += RVec3(0, 0, 7.0_r);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -65,7 +69,8 @@ void EnhancedInternalEdgeRemovalTest::Initialize()
|
|
for (int x = -10; x < 10; ++x)
|
|
for (int x = -10; x < 10; ++x)
|
|
for (int z = -10; z < 10; ++z)
|
|
for (int z = -10; z < 10; ++z)
|
|
compound_settings.AddShape(Vec3(size * x, 0, size * z), Quat::sIdentity(), box_shape);
|
|
compound_settings.AddShape(Vec3(size * x, 0, size * z), Quat::sIdentity(), box_shape);
|
|
- mBodyInterface->CreateAndAddBody(BodyCreationSettings(&compound_settings, RVec3(0, -1, -40), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
+ BodyID id = mBodyInterface->CreateAndAddBody(BodyCreationSettings(&compound_settings, RVec3(0, -1, -40), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
+ SetBodyLabel(id, "Dense grid of boxes");
|
|
|
|
|
|
CreateSlidingObjects(RVec3(-18, 1.9_r, -40.0_r));
|
|
CreateSlidingObjects(RVec3(-18, 1.9_r, -40.0_r));
|
|
}
|
|
}
|
|
@@ -95,7 +100,8 @@ void EnhancedInternalEdgeRemovalTest::Initialize()
|
|
MeshShapeSettings mesh_settings(triangles);
|
|
MeshShapeSettings mesh_settings(triangles);
|
|
mesh_settings.mActiveEdgeCosThresholdAngle = -1.0f; // Turn off regular active edge determination so that we only rely on the mEnhancedInternalEdgeRemoval flag
|
|
mesh_settings.mActiveEdgeCosThresholdAngle = -1.0f; // Turn off regular active edge determination so that we only rely on the mEnhancedInternalEdgeRemoval flag
|
|
mesh_settings.SetEmbedded();
|
|
mesh_settings.SetEmbedded();
|
|
- mBodyInterface->CreateAndAddBody(BodyCreationSettings(&mesh_settings, RVec3::sZero(), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
+ BodyID id = mBodyInterface->CreateAndAddBody(BodyCreationSettings(&mesh_settings, RVec3::sZero(), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
+ SetBodyLabel(id, "Dense triangle mesh");
|
|
|
|
|
|
CreateSlidingObjects(RVec3(-18, 1.9_r, 0));
|
|
CreateSlidingObjects(RVec3(-18, 1.9_r, 0));
|
|
}
|
|
}
|
|
@@ -144,7 +150,8 @@ void EnhancedInternalEdgeRemovalTest::Initialize()
|
|
plane_mesh.SetEmbedded();
|
|
plane_mesh.SetEmbedded();
|
|
BodyCreationSettings level_plane(&plane_mesh, RVec3(-10, 0, 50), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING);
|
|
BodyCreationSettings level_plane(&plane_mesh, RVec3(-10, 0, 50), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING);
|
|
level_plane.mFriction = 1;
|
|
level_plane.mFriction = 1;
|
|
- mBodyInterface->CreateAndAddBody(level_plane, EActivation::DontActivate);
|
|
|
|
|
|
+ BodyID id = mBodyInterface->CreateAndAddBody(level_plane, EActivation::DontActivate);
|
|
|
|
+ SetBodyLabel(id, "Dense triangle mesh");
|
|
|
|
|
|
// Roll a ball over it
|
|
// Roll a ball over it
|
|
BodyCreationSettings level_ball(new SphereShape(0.5f), RVec3(-10, 1, 41), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
BodyCreationSettings level_ball(new SphereShape(0.5f), RVec3(-10, 1, 41), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
@@ -157,7 +164,8 @@ void EnhancedInternalEdgeRemovalTest::Initialize()
|
|
// Create a sloped plane
|
|
// Create a sloped plane
|
|
BodyCreationSettings slope_plane(&plane_mesh, RVec3(10, 0, 50), Quat::sRotation(Vec3::sAxisX(), DegreesToRadians(45)), EMotionType::Static, Layers::NON_MOVING);
|
|
BodyCreationSettings slope_plane(&plane_mesh, RVec3(10, 0, 50), Quat::sRotation(Vec3::sAxisX(), DegreesToRadians(45)), EMotionType::Static, Layers::NON_MOVING);
|
|
slope_plane.mFriction = 1;
|
|
slope_plane.mFriction = 1;
|
|
- mBodyInterface->CreateAndAddBody(slope_plane, EActivation::DontActivate);
|
|
|
|
|
|
+ id = mBodyInterface->CreateAndAddBody(slope_plane, EActivation::DontActivate);
|
|
|
|
+ SetBodyLabel(id, "Dense triangle mesh");
|
|
|
|
|
|
// Roll a ball over it
|
|
// Roll a ball over it
|
|
BodyCreationSettings slope_ball(new SphereShape(0.5f), RVec3(10, 8, 44), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
BodyCreationSettings slope_ball(new SphereShape(0.5f), RVec3(10, 8, 44), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
@@ -211,7 +219,8 @@ void EnhancedInternalEdgeRemovalTest::Initialize()
|
|
MeshShapeSettings mesh_settings(triangles);
|
|
MeshShapeSettings mesh_settings(triangles);
|
|
mesh_settings.mActiveEdgeCosThresholdAngle = -1.0f; // Turn off regular active edge determination so that we only rely on the mEnhancedInternalEdgeRemoval flag
|
|
mesh_settings.mActiveEdgeCosThresholdAngle = -1.0f; // Turn off regular active edge determination so that we only rely on the mEnhancedInternalEdgeRemoval flag
|
|
mesh_settings.SetEmbedded();
|
|
mesh_settings.SetEmbedded();
|
|
- mBodyInterface->CreateAndAddBody(BodyCreationSettings(&mesh_settings, RVec3(0, 0, 80), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
|
|
+ BodyID id = mBodyInterface->CreateAndAddBody(BodyCreationSettings(&mesh_settings, RVec3(0, 0, 80), Quat::sIdentity(), EMotionType::Static, Layers::NON_MOVING), EActivation::DontActivate);
|
|
|
|
+ SetBodyLabel(id, "Dense triangle mesh");
|
|
|
|
|
|
BodyCreationSettings box_bcs(new BoxShape(Vec3::sReplicate(1.0f)), RVec3(-24, 0.9_r, 80), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
BodyCreationSettings box_bcs(new BoxShape(Vec3::sReplicate(1.0f)), RVec3(-24, 0.9_r, 80), Quat::sIdentity(), EMotionType::Dynamic, Layers::MOVING);
|
|
box_bcs.mLinearVelocity = Vec3(20, 0, 0);
|
|
box_bcs.mLinearVelocity = Vec3(20, 0, 0);
|