Function inexor::vulkan_renderer::world::ray_cube_collision_check

Function Documentation

std::optional<RayCubeCollision<Cube>> inexor::vulkan_renderer::world::ray_cube_collision_check(const Cube &cube, glm::vec3 pos, glm::vec3 dir, std::optional<std::uint32_t> max_depth = std::nullopt)

Check for a collision between a camera ray and octree geometry.


This does not account yet for octree indentation!

  • cube – The cube to check collisions with.

  • pos – The camera position.

  • dir – The camera view direction.

  • max_depth – The maximum subcube iteration depth. If this depth is reached and the cube is an octant, it will be treated as if it was a solid cube. This is the foundation for the implementation of grid size in octree editor.


A std::optional which contains the collision data (if any found).