Template Class RayCubeCollision

Class Documentation

template<typename T>
class inexor::vulkan_renderer::world::RayCubeCollision

A wrapper for collisions between a ray and octree geometry. This class is used for octree collision, but it can be used for every cube-like data structure.

tparam T

A template type which offers a size() and center() method.

Public Functions

RayCubeCollision(const T &cube, glm::vec3 ray_pos, glm::vec3 ray_dir)

Calculate point of intersection, selected face, nearest corner on that face, and nearest edge on that face.

Parameters
  • cube – The cube to check for collision.

  • ray_pos – The start point of the ray.

  • ray_dir – The direction of the ray.

RayCubeCollision(const RayCubeCollision&) = delete
RayCubeCollision(RayCubeCollision &&other) noexcept
~RayCubeCollision() = default
RayCubeCollision &operator=(const RayCubeCollision&) = delete
RayCubeCollision &operator=(RayCubeCollision&&) = delete
inline const T &cube() const noexcept
inline const glm::vec3 &intersection() const noexcept
inline const glm::vec3 &face() const noexcept
inline const glm::vec3 &corner() const noexcept
inline const glm::vec3 &edge() const noexcept

Private Members

const T &m_cube
glm::vec3 m_intersection
glm::vec3 m_selected_face
glm::vec3 m_nearest_corner
glm::vec3 m_nearest_edge