Antkeeper
0.0.1
|
Mesh collision object. More...
#include <mesh-collider.hpp>
Public Types | |
using | mesh_type = geom::brep_mesh |
Collision mesh type. More... | |
using | bvh_type = geom::bvh |
Bounding volume hierarchy type. More... | |
Public Member Functions | |
constexpr collider_type | type () const noexcept override |
Returns the collider type. More... | |
mesh_collider (std::shared_ptr< mesh_type > mesh) | |
Constructs a mesh collider from a mesh. More... | |
constexpr | mesh_collider () noexcept=default |
Constructs an empty mesh collider. More... | |
void | set_mesh (std::shared_ptr< mesh_type > mesh) |
Sets the collider's mesh. More... | |
constexpr const std::shared_ptr< mesh_type > & | get_mesh () const noexcept |
Returns the collision mesh. More... | |
constexpr const bvh_type & | get_bvh () const noexcept |
Returns the BVH of the collision mesh faces. More... | |
void | rebuild_bvh () |
Rebuilds the BVH of the collision mesh faces. More... | |
std::optional< std::tuple< float, std::uint32_t, math::fvec3 > > | intersection (const geom::ray< float, 3 > &ray) const |
Finds the nearest point of intersection between a ray and this collision mesh. More... | |
![]() | |
constexpr void | set_layer_mask (std::uint32_t mask) noexcept |
Sets the layer mask of the collider. More... | |
void | set_material (std::shared_ptr< collider_material > material) noexcept |
Sets the collider material. More... | |
constexpr std::uint32_t | get_layer_mask () const noexcept |
Returns the layer mask of the collider. More... | |
constexpr const std::shared_ptr< collider_material > & | get_material () const noexcept |
Returns the collider material. More... | |
Mesh collision object.
Definition at line 36 of file mesh-collider.hpp.
Bounding volume hierarchy type.
Definition at line 43 of file mesh-collider.hpp.
Collision mesh type.
Definition at line 40 of file mesh-collider.hpp.
|
explicit |
Constructs a mesh collider from a mesh.
mesh | Collision mesh. |
mesh
must contain the math::fvec3 vertex attribute "position". mesh
must be a triangle mesh. Definition at line 28 of file mesh-collider.cpp.
|
constexprdefaultnoexcept |
Constructs an empty mesh collider.
|
inlineconstexprnoexcept |
Returns the BVH of the collision mesh faces.
Definition at line 80 of file mesh-collider.hpp.
|
inlineconstexprnoexcept |
Returns the collision mesh.
Definition at line 74 of file mesh-collider.hpp.
std::optional< std::tuple< float, std::uint32_t, math::fvec3 > > physics::mesh_collider::intersection | ( | const geom::ray< float, 3 > & | ray | ) | const |
Finds the nearest point of intersection between a ray and this collision mesh.
ray | Mesh-space ray. |
Definition at line 80 of file mesh-collider.cpp.
void physics::mesh_collider::rebuild_bvh | ( | ) |
Rebuilds the BVH of the collision mesh faces.
Definition at line 68 of file mesh-collider.cpp.
void physics::mesh_collider::set_mesh | ( | std::shared_ptr< mesh_type > | mesh | ) |
Sets the collider's mesh.
mesh | Collision mesh. |
mesh
must contain the math::fvec3 vertex attribute "position". mesh
must be a triangle mesh. @TODO: vertex normals aren't needed for mesh colliders, they're generated here for the locomotion system (remove later)
Definition at line 33 of file mesh-collider.cpp.
|
inlineconstexproverridevirtualnoexcept |
Returns the collider type.
Implements physics::collider.
Definition at line 45 of file mesh-collider.hpp.