some J3D/misc cleanup (#2628)

* some j3d cleanup

* begin using uintptr_t

* j3dgraphbase cleanup

* j3dgraphanimator cleanup
This commit is contained in:
TakaRikka
2025-09-04 07:56:59 -07:00
committed by GitHub
parent ee8b843996
commit b45a089e15
290 changed files with 4221 additions and 3605 deletions
+11 -10
View File
@@ -2,8 +2,9 @@
#define JMATRIGONOMETRIC_H
#include "dolphin/types.h"
#include "utility.h"
#include <utility.h>
namespace JMath {
template<typename T>
struct TAngleConstant_;
@@ -19,7 +20,6 @@ struct TAngleConstant_<f32> {
static f32 RADIAN_TO_DEGREE_FACTOR() { return 180.0f / RADIAN_DEG180(); }
};
namespace JMath {
/**
* @ingroup jsystem-jmath
*
@@ -73,30 +73,31 @@ struct TAtanTable {
* @ingroup jsystem-jmath
*
*/
template<int N, typename T>
struct TAsinAcosTable {
f32 table[1025];
T table[1025];
u8 pad[0x1C];
f32 acos_(f32 x) {
T acos_(T x) const {
if (x >= 1.0f) {
return 0.0f;
} else if (x <= -1.0f) {
return TAngleConstant_<f32>::RADIAN_DEG180();
return TAngleConstant_<T>::RADIAN_DEG180();
} else if (x < 0.0f) {
return table[(u32)(-x * 1023.5f)] + TAngleConstant_<f32>::RADIAN_DEG090();
return table[(u32)(-x * 1023.5f)] + TAngleConstant_<T>::RADIAN_DEG090();
} else {
return TAngleConstant_<f32>::RADIAN_DEG090() - table[(u32)(x * 1023.5f)];
return TAngleConstant_<T>::RADIAN_DEG090() - table[(u32)(x * 1023.5f)];
}
}
f32 acosDegree(f32 x) {
return acos_(x) * TAngleConstant_<f32>::RADIAN_TO_DEGREE_FACTOR();
T acosDegree(T x) const {
return acos_(x) * TAngleConstant_<T>::RADIAN_TO_DEGREE_FACTOR();
}
};
extern TSinCosTable<13, f32> sincosTable_;
extern TAtanTable atanTable_;
extern TAsinAcosTable asinAcosTable_;
extern TAsinAcosTable<1024, f32> asinAcosTable_;
inline f32 acosDegree(f32 x) {
return asinAcosTable_.acosDegree(x);
+5
View File
@@ -80,6 +80,11 @@ inline f32 JMAHermiteInterpolation(register f32 p1, register f32 p2, register f3
namespace JMath {
template <typename T>
inline T fastSqrt(T value) {
return JMAFastSqrt(value);
}
inline f32 fastReciprocal(f32 value) {
return JMAFastReciprocal(value);
}