From 10491fbb6156695af5a17e7a562b09af736b5747 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 24 Dec 2024 08:49:20 +0300 Subject: [PATCH] add UVFace --- src/maths/UVFace.hpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/maths/UVFace.hpp diff --git a/src/maths/UVFace.hpp b/src/maths/UVFace.hpp new file mode 100644 index 00000000..538ae210 --- /dev/null +++ b/src/maths/UVFace.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +#include "UVRegion.hpp" + +struct UVFace { + std::array points; + + UVFace(const UVRegion& region) { + points[0] = {region.u1, region.v1}; + points[1] = {region.u2, region.v1}; + points[2] = {region.u2, region.v2}; + points[3] = {region.u1, region.v2}; + } + + template + inline void rotate(int times) { + int times = n % 4; + if (times < 0) { + times += 4; + } + std::array temp = points; + points[0] = temp[times]; + points[1] = temp[(times + 1) % 4]; + points[2] = temp[(times + 2) % 4]; + points[3] = temp[(times + 3) % 4]; + } +};