mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-06 17:32:23 -04:00
Fix errors when building with -ipa program (#3035)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
// don't include header until this "zero" mess is figured out
|
||||
// #include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include "JSystem/JMath/JMATrigonometric.h"
|
||||
#include <math>
|
||||
#include "global.h"
|
||||
|
||||
@@ -9,78 +8,14 @@ static f32 dummy() {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
namespace std {
|
||||
template <typename A1, typename B1>
|
||||
struct pair {
|
||||
A1 a1;
|
||||
B1 b1;
|
||||
pair() {
|
||||
a1 = A1();
|
||||
b1 = B1();
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
namespace JMath {
|
||||
template<typename T>
|
||||
struct TAngleConstant_;
|
||||
|
||||
template<>
|
||||
struct TAngleConstant_<f32> {
|
||||
static f32 RADIAN_DEG180() { return M_PI;}
|
||||
static f32 RADIAN_DEG360() { return M_PI * 2; }
|
||||
};
|
||||
|
||||
template<int N, typename T>
|
||||
struct TSinCosTable {
|
||||
std::pair<T, T> table[1 << N];
|
||||
TSinCosTable() {
|
||||
init();
|
||||
}
|
||||
void init() {
|
||||
for (int i = 0; i < 1 << N; i++) {
|
||||
table[i].a1 = sin((i * f64(TAngleConstant_<f32>::RADIAN_DEG360())) / (1 << N));
|
||||
table[i].b1 = cos((i * f64(TAngleConstant_<f32>::RADIAN_DEG360())) / (1 << N));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
inline f64 getConst2() {
|
||||
return 9.765625E-4;
|
||||
}
|
||||
|
||||
template<int N, typename T>
|
||||
struct TAtanTable {
|
||||
T table[N + 1];
|
||||
u8 pad[0x1C];
|
||||
TAtanTable() {
|
||||
init();
|
||||
}
|
||||
void init() {
|
||||
for (int i = 0; i < u32(N); i++) {
|
||||
table[i] = atan(getConst2() * i);
|
||||
}
|
||||
table[0] = 0.0f;
|
||||
table[N] = TAngleConstant_<f32>::RADIAN_DEG180() * 0.25f; // 0.25 * PI
|
||||
}
|
||||
};
|
||||
|
||||
template<int N, typename T>
|
||||
struct TAsinAcosTable {
|
||||
T table[N + 1];
|
||||
u8 pad[0x1C];
|
||||
TAsinAcosTable() {
|
||||
init();
|
||||
}
|
||||
void init() {
|
||||
for (int i = 0; i < N; i++) {
|
||||
table[i] = asin(getConst2() * i);
|
||||
}
|
||||
table[0] = 0.0f;
|
||||
table[N] = TAngleConstant_<f32>::RADIAN_DEG180() * 0.25f; // 0.25 * PI
|
||||
}
|
||||
};
|
||||
|
||||
TSinCosTable<13, f32> sincosTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
TAtanTable<1024, f32> atanTable_ ATTRIBUTE_ALIGN(32);
|
||||
|
||||
Reference in New Issue
Block a user