diff --git a/include/omath/3d_primitives/mesh.hpp b/include/omath/3d_primitives/mesh.hpp index c0ac6e4..00a8e50 100644 --- a/include/omath/3d_primitives/mesh.hpp +++ b/include/omath/3d_primitives/mesh.hpp @@ -101,7 +101,6 @@ namespace omath::primitives [[nodiscard]] VectorType vertex_position_to_world_space(const Vector3& vertex_position) const - requires HasPosition { auto abs_vec = get_to_world_matrix() * mat_column_from_vector( @@ -112,11 +111,16 @@ namespace omath::primitives [[nodiscard]] Triangle make_face_in_world_space(const Ebo::const_iterator vao_iterator) const - requires HasPosition { - return {vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->x).position), - vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->y).position), - vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->z).position)}; + if constexpr (HasPosition) + { + return {vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->x).position), + vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->y).position), + vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->z).position)}; + } + return {vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->x)), + vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->y)), + vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->z))}; } private: diff --git a/tests/general/unit_test_primitive_box.cpp b/tests/general/unit_test_primitive_box.cpp index 3d7345f..779099e 100644 --- a/tests/general/unit_test_primitive_box.cpp +++ b/tests/general/unit_test_primitive_box.cpp @@ -2,11 +2,15 @@ // Created by Vladislav on 11.01.2026. // #include "omath/3d_primitives/box.hpp" +#include "omath/collision/line_tracer.hpp" #include "omath/engines/opengl_engine/primitives.hpp" #include TEST(test, test) { - auto result = omath::primitives::create_box({0.f, 30.f, 0.f}, {}, omath::opengl_engine::k_abs_forward, - omath::opengl_engine::k_abs_right); + auto result = omath::primitives::create_box( + {0.f, 30.f, 0.f}, {}, omath::opengl_engine::k_abs_forward, omath::opengl_engine::k_abs_right); + + omath::collision::Ray ray{.start = {0, 0, 0}, .end = {-100, 0, 0}}; + std::ignore = omath::collision::LineTracer::get_ray_hit_point(ray, result); } \ No newline at end of file