mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-12 21:45:19 -04:00
Add C versions of all ASM blocks (except THP)
This commit is contained in:
@@ -39,8 +39,8 @@ struct J3DTextureSRTInfo {
|
||||
/* 0x10 */ f32 mTranslationY;
|
||||
|
||||
bool operator==(J3DTextureSRTInfo&) const;
|
||||
inline void operator=(J3DTextureSRTInfo const& other) {
|
||||
#ifdef __MWERKS__
|
||||
inline void operator=(J3DTextureSRTInfo const& other) {
|
||||
__REGISTER const f32* src = &other.mScaleX;
|
||||
__REGISTER f32* dst = &mScaleX;
|
||||
__REGISTER f32 xy;
|
||||
@@ -58,8 +58,8 @@ struct J3DTextureSRTInfo {
|
||||
psq_l xy, 0(src), 0, 0
|
||||
psq_st xy, 0(dst), 0, 0
|
||||
};
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}; // Size: 0x14
|
||||
|
||||
enum J3DTexMtxMode {
|
||||
|
||||
@@ -85,6 +85,12 @@ inline void J3DPSMtx33Copy(__REGISTER Mtx3P src, __REGISTER Mtx3P dst) {
|
||||
psq_st fr1, 0x18(dst), 0, 0
|
||||
stfs fr0, 0x20(dst)
|
||||
}
|
||||
#else
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
dst[i][j] = src[i][j];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -110,6 +116,12 @@ inline void J3DPSMtx33CopyFrom34(__REGISTER MtxP src, __REGISTER Mtx3P dst) {
|
||||
psq_st x_y3, 24(dst), 0, 0
|
||||
stfs z3, 0x20(dst)
|
||||
}
|
||||
#else
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
dst[i][j] = src[i][j];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -137,6 +149,12 @@ inline void J3DPSMulMtxVec(__REGISTER MtxP mtx, __REGISTER Vec* vec, __REGISTER
|
||||
ps_sum0 f6, f5, f6, f5
|
||||
psq_st f6, 8(dst), 1, 0
|
||||
}
|
||||
#else
|
||||
Vec tmp;
|
||||
tmp.x = mtx[0][0] * vec->x + mtx[0][1] * vec->y + mtx[0][2] * vec->z + mtx[0][3];
|
||||
tmp.y = mtx[1][0] * vec->x + mtx[1][1] * vec->y + mtx[1][2] * vec->z + mtx[1][3];
|
||||
tmp.z = mtx[2][0] * vec->x + mtx[2][1] * vec->y + mtx[2][2] * vec->z + mtx[2][3];
|
||||
*dst = tmp;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -164,6 +182,12 @@ inline void J3DPSMulMtxVec(__REGISTER MtxP mtx, __REGISTER S16Vec* vec, __REGIST
|
||||
ps_sum0 f6, f5, f6, f5
|
||||
psq_st f6, 4(dst), 1, 7
|
||||
}
|
||||
#else
|
||||
S16Vec tmp;
|
||||
tmp.x = (s16)(mtx[0][0] * vec->x + mtx[0][1] * vec->y + mtx[0][2] * vec->z + mtx[0][3]);
|
||||
tmp.y = (s16)(mtx[1][0] * vec->x + mtx[1][1] * vec->y + mtx[1][2] * vec->z + mtx[1][3]);
|
||||
tmp.z = (s16)(mtx[2][0] * vec->x + mtx[2][1] * vec->y + mtx[2][2] * vec->z + mtx[2][3]);
|
||||
*dst = tmp;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -195,6 +219,12 @@ inline void J3DPSMulMtxVec(__REGISTER Mtx3P mtx, __REGISTER Vec* vec, __REGISTER
|
||||
ps_sum0 f6, f5, f6, f5
|
||||
psq_st f6, 8(dst), 1, 0
|
||||
}
|
||||
#else
|
||||
Vec tmp;
|
||||
tmp.x = mtx[0][0] * vec->x + mtx[0][1] * vec->y + mtx[0][2] * vec->z;
|
||||
tmp.y = mtx[1][0] * vec->x + mtx[1][1] * vec->y + mtx[1][2] * vec->z;
|
||||
tmp.z = mtx[2][0] * vec->x + mtx[2][1] * vec->y + mtx[2][2] * vec->z;
|
||||
*dst = tmp;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -226,6 +256,12 @@ inline void J3DPSMulMtxVec(__REGISTER Mtx3P mtx, __REGISTER S16Vec* vec, __REGIS
|
||||
ps_sum0 f6, f5, f6, f5
|
||||
psq_st f6, 4(dst), 1, 7
|
||||
}
|
||||
#else
|
||||
S16Vec tmp;
|
||||
tmp.x = (s16)(mtx[0][0] * vec->x + mtx[0][1] * vec->y + mtx[0][2] * vec->z);
|
||||
tmp.y = (s16)(mtx[1][0] * vec->x + mtx[1][1] * vec->y + mtx[1][2] * vec->z);
|
||||
tmp.z = (s16)(mtx[2][0] * vec->x + mtx[2][1] * vec->y + mtx[2][2] * vec->z);
|
||||
*dst = tmp;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user