-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(engine): added resource to easily configure magic numbers in solver
- Loading branch information
Showing
9 changed files
with
146 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
engine/src/physics/solver/integration/physics_constants_integration.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "physics_constants_integration.hpp" | ||
|
||
#include <cubos/core/ecs/reflection.hpp> | ||
#include <cubos/core/reflection/external/primitives.hpp> | ||
|
||
CUBOS_REFLECT_IMPL(cubos::engine::PhysicsConstantsIntegration) | ||
{ | ||
return core::ecs::TypeBuilder<PhysicsConstantsIntegration>("cubos::engine::PhysicsConstantsIntegration") | ||
.withField("minInvMass", &PhysicsConstantsIntegration::minInvMass) | ||
.withField("minInvInertia", &PhysicsConstantsIntegration::minInvInertia) | ||
.build(); | ||
} |
24 changes: 24 additions & 0 deletions
24
engine/src/physics/solver/integration/physics_constants_integration.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/// @file | ||
/// @brief Resource @ref cubos::engine::PhysicsConstantsIntegration. | ||
/// @ingroup physics-plugin | ||
|
||
#pragma once | ||
|
||
#include <cubos/core/reflection/reflect.hpp> | ||
|
||
#include <cubos/engine/api.hpp> | ||
|
||
namespace cubos::engine | ||
{ | ||
/// @brief Resource which allows configuration over constants in the integration plugin. | ||
/// @ingroup physics-plugin | ||
struct PhysicsConstantsIntegration | ||
{ | ||
CUBOS_REFLECT; | ||
|
||
float minInvMass = 0.0F; | ||
|
||
float minInvInertia = 0.0F; | ||
}; | ||
|
||
} // namespace cubos::engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
engine/src/physics/solver/penetration_constraint/physics_constants_pc.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include "physics_constants_pc.hpp" | ||
|
||
#include <cubos/core/ecs/reflection.hpp> | ||
#include <cubos/core/reflection/external/primitives.hpp> | ||
|
||
CUBOS_REFLECT_IMPL(cubos::engine::PhysicsConstantsPC) | ||
{ | ||
return core::ecs::TypeBuilder<PhysicsConstantsPC>("cubos::engine::PhysicsConstantsPC") | ||
.withField("maxBias", &PhysicsConstantsPC::maxBias) | ||
.withField("minContactHertz", &PhysicsConstantsPC::minContactHertz) | ||
.withField("minKNormal", &PhysicsConstantsPC::minKNormal) | ||
.withField("minKFriction", &PhysicsConstantsPC::minKFriction) | ||
.withField("minTangentLenSq", &PhysicsConstantsPC::minTangentLenSq) | ||
.withField("minRestitution", &PhysicsConstantsPC::minRestitution) | ||
.withField("minNormalSpeed", &PhysicsConstantsPC::minNormalSpeed) | ||
.withField("minNormalImpulse", &PhysicsConstantsPC::minNormalImpulse) | ||
.build(); | ||
} |
36 changes: 36 additions & 0 deletions
36
engine/src/physics/solver/penetration_constraint/physics_constants_pc.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// @file | ||
/// @brief Resource @ref cubos::engine::PhysicsConstantsPC. | ||
/// @ingroup physics-plugin | ||
|
||
#pragma once | ||
|
||
#include <cubos/core/reflection/reflect.hpp> | ||
|
||
#include <cubos/engine/api.hpp> | ||
|
||
namespace cubos::engine | ||
{ | ||
/// @brief Resource which allows configuration over magic numbers in the solver plugin. | ||
/// @ingroup physics-plugin | ||
struct PhysicsConstantsPC | ||
{ | ||
CUBOS_REFLECT; | ||
|
||
float maxBias = -4.0F; | ||
|
||
float minContactHertz = 30.0F; | ||
|
||
float minKNormal = 0.0F; | ||
|
||
float minKFriction = 0.0F; | ||
|
||
float minTangentLenSq = 1e-6F * 1e-6F; | ||
|
||
float minRestitution = 0.0F; | ||
|
||
float minNormalSpeed = -0.01F; | ||
|
||
float minNormalImpulse = 0.0F; | ||
}; | ||
|
||
} // namespace cubos::engine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters