|
Sparkle 0.0.1
|
Convex collision mesh built from 2D points. More...
#include <spk_collision_mesh_2d.hpp>


Public Types | |
| using | Polygon = spk::IMesh<spk::Vector2>::Polygon |
| Polygon type used for collision triangles. | |
| using | EditionContract = spk::IMesh<spk::Vector2>::EditionContract |
| Contract type for mesh edition notifications. | |
| Public Types inherited from spk::IMesh< spk::Vector2 > | |
| using | Polygon |
| Polygon type stored by the mesh. | |
| using | EditionContract |
| Contract type returned by edition subscriptions. | |
| using | EditionJob |
| Job type invoked on mesh edits. | |
Public Member Functions | |
| CollisionMesh2D () | |
| Creates an empty collision mesh. | |
| CollisionMesh2D (const CollisionMesh2D &p_other) | |
| Copies another collision mesh. | |
| CollisionMesh2D & | operator= (const CollisionMesh2D &p_other) |
| Copy-assigns another collision mesh. | |
| CollisionMesh2D (CollisionMesh2D &&p_other) noexcept | |
| Move-constructs a collision mesh. | |
| CollisionMesh2D & | operator= (CollisionMesh2D &&p_other) noexcept |
| Move-assigns a collision mesh. | |
| template<typename TMesh> | |
| CollisionMesh2D (const TMesh &p_mesh, const std::function< spk::Vector2(const typename TMesh::Vertex &)> &p_positionExtractor) | |
| Builds a convex collision mesh from another mesh type. | |
| bool | collideWith (const CollisionMesh2D &p_other, const Transform2D &p_selfTransform, const Transform2D &p_otherTransform) const |
| Tests collision against another mesh using transform components. | |
| bool | collideWith (const spk::Vector2 &p_worldPoint, const Transform2D &p_selfTransform) const |
| Tests collision with a world-space point using a transform component. | |
| bool | collideWith (const CollisionMesh2D &p_other, const spk::Matrix4x4 &p_selfTransform, const spk::Matrix4x4 &p_otherTransform) const |
| Tests collision against another mesh using explicit matrices. | |
| bool | collideWith (const spk::Vector2 &p_worldPoint, const spk::Matrix4x4 &p_selfTransform) const |
| Tests collision with a world-space point using a matrix. | |
| const spk::BoundingBox2D & | boundingBox () const |
| Returns the axis-aligned bounding box in local space. | |
| Public Member Functions inherited from spk::IMesh< spk::Vector2 > | |
| IMesh () | |
| Builds an empty mesh with a dynamic buffer set. | |
| IMesh & | operator= (const IMesh &p_other) |
| Assigns polygon data from another mesh. | |
| void | clear () |
| Clears all polygons and notifies subscribers. | |
| void | append (const Polygon &p_shape) |
| Appends a polygon and notifies subscribers. | |
| EditionContract | subscribeToEdition (const EditionJob &p_job) const |
| Subscribes to mesh edition notifications. | |
| const std::vector< spk::Vector2 > & | vertices () const |
| Returns the cached vertex list for all polygons. | |
| const std::vector< Polygon > & | polygons () const |
| Returns the stored polygons. | |
| const std::vector< uint32_t > & | indexes () const |
| Returns the cached triangle indices for the mesh. | |
| IMesh & | operator+= (const IMesh &p_other) |
| Appends polygons from another mesh and notifies subscribers. | |
| const std::shared_ptr< spk::OpenGL::BufferSetObject > & | bufferSet () const |
| Returns the underlying buffer set. | |
| void | synchronize () const |
| Updates GPU buffers when mesh data has changed. | |
| IMesh | fuze (const IMesh &p_other) const |
| Returns a new mesh by concatenating another mesh. | |
Protected Member Functions | |
| void | _configureBufferSet () const override |
| Configures the vertex buffer layout for this mesh. | |
Convex collision mesh built from 2D points.
| spk::CollisionMesh2D::CollisionMesh2D | ( | const CollisionMesh2D & | p_other | ) |
Copies another collision mesh.
| p_other | Mesh to copy from. |

|
noexcept |
Move-constructs a collision mesh.
| p_other | Mesh to move from. |

|
inlineexplicit |
Builds a convex collision mesh from another mesh type.
| TMesh | Mesh type providing polygons() and Vertex. |
| p_mesh | Source mesh to sample. |
| p_positionExtractor | Function returning the world position of a vertex. |

|
inlineoverrideprotectedvirtual |
Configures the vertex buffer layout for this mesh.
Implements spk::IMesh< spk::Vector2 >.

| const spk::BoundingBox2D & spk::CollisionMesh2D::boundingBox | ( | ) | const |
Returns the axis-aligned bounding box in local space.


| bool spk::CollisionMesh2D::collideWith | ( | const CollisionMesh2D & | p_other, |
| const spk::Matrix4x4 & | p_selfTransform, | ||
| const spk::Matrix4x4 & | p_otherTransform ) const |
Tests collision against another mesh using explicit matrices.
| p_other | Other mesh to collide with. |
| p_selfTransform | Matrix for this mesh. |
| p_otherTransform | Matrix for the other mesh. |

| bool spk::CollisionMesh2D::collideWith | ( | const CollisionMesh2D & | p_other, |
| const Transform2D & | p_selfTransform, | ||
| const Transform2D & | p_otherTransform ) const |
Tests collision against another mesh using transform components.
| p_other | Other mesh to collide with. |
| p_selfTransform | Transform applied to this mesh. |
| p_otherTransform | Transform applied to the other mesh. |


| bool spk::CollisionMesh2D::collideWith | ( | const spk::Vector2 & | p_worldPoint, |
| const spk::Matrix4x4 & | p_selfTransform ) const |
Tests collision with a world-space point using a matrix.
| p_worldPoint | Point in world space. |
| p_selfTransform | Matrix for this mesh. |

| bool spk::CollisionMesh2D::collideWith | ( | const spk::Vector2 & | p_worldPoint, |
| const Transform2D & | p_selfTransform ) const |
Tests collision with a world-space point using a transform component.
| p_worldPoint | Point in world space. |
| p_selfTransform | Transform applied to this mesh. |

|
noexcept |
Move-assigns a collision mesh.
| p_other | Mesh to move from. |

| CollisionMesh2D & spk::CollisionMesh2D::operator= | ( | const CollisionMesh2D & | p_other | ) |
Copy-assigns another collision mesh.
| p_other | Mesh to copy from. |
