From 1aff083ef37de2e18d83a6589fe86df74b9150ec Mon Sep 17 00:00:00 2001 From: Orange Date: Mon, 1 Dec 2025 05:03:43 +0300 Subject: [PATCH] fixed uv type --- examples/example_glfw3.cpp | 16 ++++++++-------- include/omath/3d_primitives/mesh.hpp | 7 ++++--- include/omath/collision/epa_algorithm.hpp | 6 +++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/examples/example_glfw3.cpp b/examples/example_glfw3.cpp index 07fcfbf..0a3c5e3 100644 --- a/examples/example_glfw3.cpp +++ b/examples/example_glfw3.cpp @@ -173,14 +173,14 @@ int main() Vector3 p110{0.5f, 0.5f, -0.5f}; Vector3 p111{0.5f, 0.5f, 0.5f}; - VertexType v0{p000, Vector3{-1, -1, -1}, Vector3{0, 0, 0}}; - VertexType v1{p001, Vector3{-1, -1, 1}, Vector3{0, 1, 0}}; - VertexType v2{p010, Vector3{-1, 1, -1}, Vector3{1, 0, 0}}; - VertexType v3{p011, Vector3{-1, 1, 1}, Vector3{1, 1, 0}}; - VertexType v4{p100, Vector3{1, -1, -1}, Vector3{0, 0, 1}}; - VertexType v5{p101, Vector3{1, -1, 1}, Vector3{0, 1, 1}}; - VertexType v6{p110, Vector3{1, 1, -1}, Vector3{1, 0, 1}}; - VertexType v7{p111, Vector3{1, 1, 1}, Vector3{1, 1, 1}}; + VertexType v0{p000, Vector3{-1, -1, -1}, omath::Vector2{0, 0}}; + VertexType v1{p001, Vector3{-1, -1, 1}, omath::Vector2{0, 1}}; + VertexType v2{p010, Vector3{-1, 1, -1}, omath::Vector2{1, 0}}; + VertexType v3{p011, Vector3{-1, 1, 1}, omath::Vector2{1, 1}}; + VertexType v4{p100, Vector3{1, -1, -1}, omath::Vector2{0, 0}}; + VertexType v5{p101, Vector3{1, -1, 1}, omath::Vector2{0, 1}}; + VertexType v6{p110, Vector3{1, 1, -1}, omath::Vector2{1, 0}}; + VertexType v7{p111, Vector3{1, 1, 1}, omath::Vector2{1, 1}}; vbo.push_back(v0); // 0 vbo.push_back(v1); // 1 diff --git a/include/omath/3d_primitives/mesh.hpp b/include/omath/3d_primitives/mesh.hpp index 357d722..baaa8cd 100644 --- a/include/omath/3d_primitives/mesh.hpp +++ b/include/omath/3d_primitives/mesh.hpp @@ -11,13 +11,14 @@ namespace omath::primitives { - template> + template, class UvT = Vector2> struct Vertex final { - using VectorType = T; + using VectorType = VecType; + using UvType = UvT; VectorType position; VectorType normal; - VectorType uv; + UvType uv; }; template concept HasPosition = requires(T vertex) { vertex.position; }; diff --git a/include/omath/collision/epa_algorithm.hpp b/include/omath/collision/epa_algorithm.hpp index c7eac7e..4bcdb30 100644 --- a/include/omath/collision/epa_algorithm.hpp +++ b/include/omath/collision/epa_algorithm.hpp @@ -24,7 +24,7 @@ namespace omath::collision class Epa final { public: - using VectorType = typename ColliderType::VectorType; + using VectorType = ColliderType::VectorType; static_assert(EpaVector, "VertexType must satisfy EpaVector concept"); struct Result final @@ -45,8 +45,8 @@ namespace omath::collision // Precondition: simplex.size()==4 and contains the origin. [[nodiscard]] - static std::optional solve(const ColliderType& a, const ColliderType& b, const Simplex& simplex, - const Params params = {}) + static std::optional solve(const ColliderType& a, const ColliderType& b, + const Simplex& simplex, const Params params = {}) { // --- Build initial polytope from simplex (4 points) --- std::vector vertexes;