Generic box type for any collision algorithm implementation derived from CollisionAlgorithmImplementation<N>.
More...
#include <GREM/physics/collision.hpp>
|
| CollisionFilterTestResult | hasCollision (ArenaResource *temporaryMemoryResource, Length1D minPenetrationDepth, ColliderView< N > colliderA, const Transformation< N > &transformationA, ColliderView< N > colliderB, const Transformation< N > &transformationB, const CollisionAlgorithmOptions< N > &options, CollisionFilterTest filterTest) |
| | Perform collision detection using the underlying collision algorithm and determine whether two objects have any touching surfaces or not.
|
| void | detectCollisions (ArenaResource *temporaryMemoryResource, ColliderView< N > colliderA, const Transformation< N > &transformationA, ColliderView< N > colliderB, const Transformation< N > &transformationB, const CollisionAlgorithmOptions< N > &options, CollisionFilterTest filterTest, FunctionView< void(const CollisionAlgorithmResult< N > &collision)> callback) |
| | Perform collision detection using the underlying collision algorithm and generate contact manifolds for touching surfaces.
|
|
| template<typename Implementation, typename... Args> |
| static CollisionAlgorithm | create (Args &&... args) |
| | Create a boxed collision algorithm with a specific implementation.
|
| static CollisionAlgorithm | chooseImplementation (ShapeView< N > shapeA, ShapeView< N > shapeB) |
| | Create a boxed collision algorithm with an implementation that can be used to generate contact points for a given ordered pair of shapes.
|
|
| static constexpr size_t | MAX_CAPACITY = max(sizeof(void*) * 20, size_t{144}) |
| | Maximum capacity for concrete collision algorithm implementations.
|
| static constexpr size_t | MAX_ALIGNMENT = max(alignof(void*), size_t{16}) |
| | Maximum alignment for concrete collision algorithm implementations.
|
template<size_t N>
class grem::physics::CollisionAlgorithm< N >
Generic box type for any collision algorithm implementation derived from CollisionAlgorithmImplementation<N>.
◆ create()
template<size_t N>
template<typename Implementation, typename... Args>
Create a boxed collision algorithm with a specific implementation.
- Template Parameters
-
| Implementation | concrete collision algorithm type. |
- Parameters
-
| args | arguments to forward to the concrete collision algorithm constructor. |
- Returns
- the new boxed collision algorithm.
- Exceptions
-
| any | exception thrown by the concrete collision algorithm's constructor. |
| std::bad_alloc | on allocation failure. |
- Warning
- CollisionAlgorithmImplementation<N> must be the only base class of the implementation type.
◆ chooseImplementation()
Create a boxed collision algorithm with an implementation that can be used to generate contact points for a given ordered pair of shapes.
- Parameters
-
| shapeA | the first shape in the pair of shapes to choose a collision algorithm for. |
| shapeB | the second shape to the pair of shapes to choose a collision algorithm for. |
- Exceptions
-
| std::bad_alloc | on allocation failure. |
◆ hasCollision()
Perform collision detection using the underlying collision algorithm and determine whether two objects have any touching surfaces or not.
- Parameters
-
| temporaryMemoryResource | non-null non-owning pointer to a memory resource to use for temporary memory allocations, which will all be deallocated by the time the function returns. |
| minPenetrationDepth | minimum penetration depth for a contact to be considered to be colliding. |
| colliderA | collider of the first object. Must have the same shape type as the first of the two shapes that this collision algorithm was created to handle. |
| transformationA | world-space transformation of the first object. |
| colliderB | collider of the second object. Must have the same shape type as the second of the two shapes that this collision algorithm was created to handle. |
| transformationB | world-space transformation of the second object. |
| options | collision algorithm options, see CollisionAlgorithmOptions. Should usually be simulation.resources.getResource<SimulationOptions<N>>().collisionAlgorithmOptions. |
| filterTest | test that potential colliders must pass in order to be considered for collision. |
- Returns
- the result of the test, or an empty test result that converts to false if the objects weren't colliding.
- Exceptions
-
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
◆ detectCollisions()
Perform collision detection using the underlying collision algorithm and generate contact manifolds for touching surfaces.
- Parameters
-
| temporaryMemoryResource | non-null non-owning pointer to a memory resource to use for temporary memory allocations, which will all be deallocated by the time the function returns. |
| colliderA | collider of the first object. Must have the same shape type as the first of the two shapes that this collision algorithm was created to handle. |
| transformationA | world-space transformation of the first object. |
| colliderB | collider of the second object. Must have the same shape type as the second of the two shapes that this collision algorithm was created to handle. |
| transformationB | world-space transformation of the second object. |
| options | collision algorithm options, see CollisionAlgorithmOptions. Should usually be simulation.resources.getResource<SimulationOptions<N>>().collisionAlgorithmOptions. |
| filterTest | test that potential colliders must pass in order to be considered for collision. |
| callback | function to pass the results to. |
- Exceptions
-
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| any | exception thrown by the callback function. |
◆ MAX_CAPACITY
Maximum capacity for concrete collision algorithm implementations.
◆ MAX_ALIGNMENT
Maximum alignment for concrete collision algorithm implementations.
The documentation for this class was generated from the following file: