mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-09 22:11:35 -04:00
JPAMath start
This commit is contained in:
@@ -151,10 +151,10 @@ struct TVec3<f32> {
|
||||
return C_VECSquareMag((Vec*)&x);
|
||||
}
|
||||
|
||||
void normalize() {
|
||||
f32 normalize() {
|
||||
f32 sq = squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
return;
|
||||
return 0.0f;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
@@ -162,14 +162,15 @@ struct TVec3<f32> {
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
scale(norm);
|
||||
scale(1.0f / norm);
|
||||
return norm;
|
||||
}
|
||||
|
||||
void normalize(const TVec3<f32>& other) {
|
||||
f32 normalize(const TVec3<f32>& other) {
|
||||
f32 sq = other.squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
zero();
|
||||
return;
|
||||
return 0.0f;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
@@ -177,7 +178,8 @@ struct TVec3<f32> {
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
scale(norm, other);
|
||||
scale(1.0f / norm, other);
|
||||
return norm;
|
||||
}
|
||||
|
||||
f32 length() const {
|
||||
@@ -249,7 +251,7 @@ struct TVec3<f32> {
|
||||
void cross(const TVec3<f32>& a, const TVec3<f32>& b) {
|
||||
VECCrossProduct(a, b, *this);
|
||||
}
|
||||
|
||||
|
||||
void setLength(f32 len) {
|
||||
f32 sq = squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
|
||||
@@ -118,4 +118,6 @@ inline void gekko_ps_copy16(register void* dst, register const void* src) {
|
||||
|
||||
}; // namespace JMath
|
||||
|
||||
f32 JMAHermiteInterpolation(f32, f32, f32, f32, f32, f32, f32);
|
||||
|
||||
#endif /* JMATH_H */
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "dolphin/types.h"
|
||||
|
||||
void JPAGetYZRotateMtx(short, short, float(*)[4]);
|
||||
void JPAGetXYZRotateMtx(short, short, short, float(*)[4]);
|
||||
void JPAGetDirMtx(const JGeometry::TVec3<float>&, float(*)[4]);
|
||||
void JPASetSVecfromMtx(float(*)[4], JGeometry::TVec3<float>&);
|
||||
void JPASetRMtxTVecfromMtx(float(*)[4], float(*)[4], JGeometry::TVec3<float>&);
|
||||
void JPASetRMtxSTVecfromMtx(float(*)[4], float(*)[4], JGeometry::TVec3<float>&, JGeometry::TVec3<float>&);
|
||||
void JPAGetKeyFrameValue(float, unsigned short, const float*);
|
||||
void JPAGetUnitVec(short, short, JGeometry::TVec3<float>&);
|
||||
void JPAGetYZRotateMtx(s16, s16, f32(*)[4]);
|
||||
void JPAGetXYZRotateMtx(s16, s16, s16, f32(*)[4]);
|
||||
void JPAGetDirMtx(const JGeometry::TVec3<f32>&, f32(*)[4]);
|
||||
void JPASetSVecfromMtx(f32(*)[4], JGeometry::TVec3<f32>&);
|
||||
void JPASetRMtxTVecfromMtx(f32(*)[4], f32(*)[4], JGeometry::TVec3<f32>&);
|
||||
void JPASetRMtxSTVecfromMtx(f32(*)[4], f32(*)[4], JGeometry::TVec3<f32>&, JGeometry::TVec3<f32>&);
|
||||
f32 JPAGetKeyFrameValue(f32, u16, const f32*);
|
||||
void JPAGetUnitVec(s16, s16, JGeometry::TVec3<f32>&);
|
||||
|
||||
#endif /* JPAMATH_H */
|
||||
|
||||
Reference in New Issue
Block a user