Skip to content

Commit efa20e3

Browse files
committed
[collision-query] Add nolints and doxygen comments
1 parent d864153 commit efa20e3

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

include/inexor/vulkan-renderer/world/collision.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ class RayCubeCollision {
2828
glm::vec3 m_nearest_cube_edge;
2929

3030
public:
31+
/// @brief Default constructor
32+
/// @param The cube to check collisions with
33+
/// @param ray The start point of the ray
34+
/// @param dir The direction of the ray
35+
/// @param The intersection between ray and vertex geometry of the cube which was found
3136
RayCubeCollision(std::shared_ptr<T> cube, glm::vec3 ray, glm::vec3 dir,
3237
std::optional<glm::vec3> vertex_intersection = std::nullopt);
3338

39+
/// @note This method returns a copy of the cube, not a const reference.
3440
[[nodiscard]] std::shared_ptr<T> cube() const noexcept {
3541
return m_cube;
3642
}

src/vulkan-renderer/world/collision.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace inexor::vulkan_renderer::world {
1313

1414
template <typename T>
15-
RayCubeCollision<T>::RayCubeCollision(const std::shared_ptr<T> cube, const glm::vec3 ray_pos, const glm::vec3 ray_dir,
16-
const std::optional<glm::vec3> vertex_intersection)
15+
RayCubeCollision<T>::RayCubeCollision(const std::shared_ptr<T> cube, const glm::vec3 ray_pos, // NOLINT
16+
const glm::vec3 ray_dir, const std::optional<glm::vec3> vertex_intersection)
1717
: m_cube(cube), m_vertex_intersection(vertex_intersection) {
1818

1919
/// In order to work with cubes of arbitrary size, this lambda calculates the center of a cube's face with respect

src/vulkan-renderer/world/collision_query.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ bool ray_box_collision(const std::array<glm::vec3, 2> &box_bounds, const glm::ve
3737
return !((tmin > tzmax) || (tzmin > tmax));
3838
}
3939

40-
std::optional<glm::vec3> ray_cube_vertex_intersection(const std::shared_ptr<Cube> cube, const glm::vec3 pos,
41-
const glm::vec3 dir) {
40+
std::optional<glm::vec3> ray_cube_vertex_intersection(const std::shared_ptr<Cube> cube, // NOLINT
41+
const glm::vec3 pos, const glm::vec3 dir) {
4242
const auto cube_polygons = cube->polygons();
4343

4444
// If the cube does not contain any vertex data, no collision with vertex data can take place inside of it.
@@ -76,8 +76,8 @@ std::optional<glm::vec3> ray_cube_vertex_intersection(const std::shared_ptr<Cube
7676
return vertex_intersection;
7777
}
7878

79-
[[nodiscard]] bool is_bounding_box_and_bounding_sphere_hit(const std::shared_ptr<Cube> cube, const glm::vec3 pos,
80-
const glm::vec3 dir) {
79+
[[nodiscard]] bool is_bounding_box_and_bounding_sphere_hit(const std::shared_ptr<Cube> cube, // NOLINT
80+
const glm::vec3 pos, const glm::vec3 dir) {
8181
// We need to pass this into glm::intersectRaySphere by reference although we are not interested in it.
8282
auto intersection_distance{0.0f};
8383
const auto bounding_sphere_radius = static_cast<float>(glm::sqrt(3) * cube->size()) / 2.0f;
@@ -98,8 +98,8 @@ std::optional<glm::vec3> ray_cube_vertex_intersection(const std::shared_ptr<Cube
9898
return true;
9999
}
100100

101-
std::optional<RayCubeCollision<Cube>> ray_cube_collision_check(const std::shared_ptr<Cube> cube, const glm::vec3 pos,
102-
const glm::vec3 dir,
101+
std::optional<RayCubeCollision<Cube>> ray_cube_collision_check(const std::shared_ptr<Cube> cube, // NOLINT
102+
const glm::vec3 pos, const glm::vec3 dir,
103103
const std::optional<std::uint32_t> grid_level_counter) {
104104

105105
if (cube->type() == Cube::Type::EMPTY || !is_bounding_box_and_bounding_sphere_hit(cube, pos, dir)) {

0 commit comments

Comments
 (0)