-
Notifications
You must be signed in to change notification settings - Fork 32
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
142 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("cmpInvMass", &PhysicsConstantsIntegration::cmpInvMass) | ||
.withField("cmpInvInertia", &PhysicsConstantsIntegration::cmpInvInertia) | ||
.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::MagiConfig. | ||
/// @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 PhysicsConstantsIntegration | ||
{ | ||
CUBOS_REFLECT; | ||
|
||
float cmpInvMass = 0.0F; | ||
|
||
float cmpInvInertia = 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("biasMax", &PhysicsConstantsPC::biasMax) | ||
.withField("contactHertzMin", &PhysicsConstantsPC::contactHertzMin) | ||
.withField("kNormal", &PhysicsConstantsPC::kNormal) | ||
.withField("kFriction", &PhysicsConstantsPC::kFriction) | ||
.withField("cmpTangentLenSq", &PhysicsConstantsPC::cmpTangentLenSq) | ||
.withField("cmpRestitution", &PhysicsConstantsPC::cmpRestitution) | ||
.withField("cmpNormalSpeed", &PhysicsConstantsPC::cmpNormalSpeed) | ||
.withField("cmpNormalImpulse", &PhysicsConstantsPC::cmpNormalImpulse) | ||
.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::MagiConfig. | ||
/// @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 biasMax = -4.0F; | ||
|
||
float contactHertzMin = 30.0F; | ||
|
||
float kNormal = 0.0F; | ||
|
||
float kFriction = 0.0F; | ||
|
||
float cmpTangentLenSq = 1e-6F * 1e-6F; | ||
|
||
float cmpRestitution = 0.0F; | ||
|
||
float cmpNormalSpeed = -0.01F; | ||
|
||
float cmpNormalImpulse = 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