123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #pragma once
- #include <Mathematics/FeatureKey.h>
- namespace WwiseGTE
- {
- template <bool Ordered>
- class TriangleKey : public FeatureKey<3, Ordered>
- {
- public:
- TriangleKey()
- {
- this->V = { -1, -1, -1 };
- }
-
- explicit TriangleKey(int v0, int v1, int v2)
- {
- Initialize(v0, v1, v2);
- }
- private:
- template <bool Dummy = Ordered>
- typename std::enable_if<Dummy, void>::type
- Initialize(int v0, int v1, int v2)
- {
- if (v0 < v1)
- {
- if (v0 < v2)
- {
-
- this->V[0] = v0;
- this->V[1] = v1;
- this->V[2] = v2;
- }
- else
- {
-
- this->V[0] = v2;
- this->V[1] = v0;
- this->V[2] = v1;
- }
- }
- else
- {
- if (v1 < v2)
- {
-
- this->V[0] = v1;
- this->V[1] = v2;
- this->V[2] = v0;
- }
- else
- {
-
- this->V[0] = v2;
- this->V[1] = v0;
- this->V[2] = v1;
- }
- }
- }
- template <bool Dummy = Ordered>
- typename std::enable_if<!Dummy, void>::type
- Initialize(int v0, int v1, int v2)
- {
- if (v0 < v1)
- {
- if (v0 < v2)
- {
-
- this->V[0] = v0;
- this->V[1] = std::min(v1, v2);
- this->V[2] = std::max(v1, v2);
- }
- else
- {
-
- this->V[0] = v2;
- this->V[1] = std::min(v0, v1);
- this->V[2] = std::max(v0, v1);
- }
- }
- else
- {
- if (v1 < v2)
- {
-
- this->V[0] = v1;
- this->V[1] = std::min(v2, v0);
- this->V[2] = std::max(v2, v0);
- }
- else
- {
-
- this->V[0] = v2;
- this->V[1] = std::min(v0, v1);
- this->V[2] = std::max(v0, v1);
- }
- }
- }
- };
- }
|