Skip to content

Commit f67ad8e

Browse files
committed
mesh improvement
1 parent acc24f8 commit f67ad8e

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

include/omath/3d_primitives/mesh.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ namespace omath::primitives
101101

102102
[[nodiscard]]
103103
VectorType vertex_position_to_world_space(const Vector3<float>& vertex_position) const
104-
requires HasPosition<VertexType>
105104
{
106105
auto abs_vec = get_to_world_matrix()
107106
* mat_column_from_vector<typename Mat4X4::ContainedType, Mat4X4::get_store_ordering()>(
@@ -112,11 +111,16 @@ namespace omath::primitives
112111

113112
[[nodiscard]]
114113
Triangle<VectorType> make_face_in_world_space(const Ebo::const_iterator vao_iterator) const
115-
requires HasPosition<VertexType>
116114
{
117-
return {vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->x).position),
118-
vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->y).position),
119-
vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->z).position)};
115+
if constexpr (HasPosition<VertexType>)
116+
{
117+
return {vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->x).position),
118+
vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->y).position),
119+
vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->z).position)};
120+
}
121+
return {vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->x)),
122+
vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->y)),
123+
vertex_position_to_world_space(m_vertex_buffer.at(vao_iterator->z))};
120124
}
121125

122126
private:

tests/general/unit_test_primitive_box.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
// Created by Vladislav on 11.01.2026.
33
//
44
#include "omath/3d_primitives/box.hpp"
5+
#include "omath/collision/line_tracer.hpp"
56
#include "omath/engines/opengl_engine/primitives.hpp"
67
#include <gtest/gtest.h>
78

89
TEST(test, test)
910
{
10-
auto result = omath::primitives::create_box<omath::opengl_engine::BoxMesh>({0.f, 30.f, 0.f}, {}, omath::opengl_engine::k_abs_forward,
11-
omath::opengl_engine::k_abs_right);
11+
auto result = omath::primitives::create_box<omath::opengl_engine::BoxMesh>(
12+
{0.f, 30.f, 0.f}, {}, omath::opengl_engine::k_abs_forward, omath::opengl_engine::k_abs_right);
13+
14+
omath::collision::Ray ray{.start = {0, 0, 0}, .end = {-100, 0, 0}};
15+
std::ignore = omath::collision::LineTracer::get_ray_hit_point(ray, result);
1216
}

0 commit comments

Comments
 (0)