diff --git a/src/maths/UVFace.hpp b/src/maths/UVFace.hpp new file mode 100644 index 000000000..538ae2107 --- /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]; + } +};