summaryrefslogtreecommitdiff
path: root/src/JSystem/JParticle/JPAExTexShape.cpp
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2025-04-27 16:23:42 +0200
committerrobojumper <robojumper@gmail.com>2025-04-27 16:23:42 +0200
commitf6b74534a3fe5d92131d22c38a92fc3d1cd21567 (patch)
tree635dead1bae64269e535ea82cd36563756f82ae9 /src/JSystem/JParticle/JPAExTexShape.cpp
parent9e5c1c9cbb62eb4e99f46cb63f908e492665eeef (diff)
JPAExTexShape OK
Diffstat (limited to 'src/JSystem/JParticle/JPAExTexShape.cpp')
-rw-r--r--src/JSystem/JParticle/JPAExTexShape.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/JSystem/JParticle/JPAExTexShape.cpp b/src/JSystem/JParticle/JPAExTexShape.cpp
index 3264be66..7d8d08f2 100644
--- a/src/JSystem/JParticle/JPAExTexShape.cpp
+++ b/src/JSystem/JParticle/JPAExTexShape.cpp
@@ -39,37 +39,34 @@ JPAExTexShape::JPAExTexShape(u8 const* data) {
mpData = (const JPAExTexShapeData*)data;
}
+// Similar to JPAGenCalcTexCrdMtxAnm
void JPAExTexShape::fn_8031DE80(const JPABaseShape *shp, f32 f) const {
- f32 _0x38_x_0x24 = f * mpData->field_0x38 + mpData->field_0x24;
- f32 _0x3C_x_0x28 = f * mpData->field_0x3C + mpData->field_0x28;
- f32 _0x40_x_0x2C = f * mpData->field_0x40 + mpData->field_0x2C;
- f32 _0x44_x_0x30 = f * mpData->field_0x44 + mpData->field_0x30;
+ f32 tilingS = 0.5f * (1.0f + shp->getTilingS());
+ f32 tilingT = 0.5f * (1.0f + shp->getTilingT());
+ f32 _0x38_x_0x24 = f * getField_0x38() + getField_0x24();
+ f32 _0x3C_x_0x28 = f * getField_0x3C() + getField_0x28();
+ f32 _0x40_x_0x2C = f * getField_0x40() + getField_0x2C();
+ f32 _0x44_x_0x30 = f * getField_0x44() + getField_0x30();
- f32 tilingS = 0.5f * (shp->getTilingS() + 1.0f);
- f32 tilingT = 0.5f * (shp->getTilingT() + 1.0f);
-
- s16 v = f * mpData->field_0x48 * 32768.0f + mpData->field_0x34 * 32768.0f;
+ s16 v = f * getField_0x48() * 0x8000 + getField_0x34() * 0x8000;
f32 sin = nw4r::math::SinIdx(v);
f32 cos = nw4r::math::CosIdx(v);
- f32 fS2 = tilingS + _0x38_x_0x24;
- f32 fT2 = tilingT + _0x3C_x_0x28;
-
Mtx texMtx;
texMtx[0][0] = _0x40_x_0x2C * cos;
texMtx[0][1] = -_0x40_x_0x2C * sin;
texMtx[0][2] = 0.0f;
- texMtx[0][3] = tilingS + _0x40_x_0x2C * (sin * fT2 - cos * fS2);
+ texMtx[0][3] = tilingS + (_0x40_x_0x2C * (sin * (tilingT + _0x3C_x_0x28) - cos * (tilingS + _0x38_x_0x24)));
texMtx[1][0] = _0x44_x_0x30 * sin;
texMtx[1][1] = _0x44_x_0x30 * cos;
texMtx[1][2] = 0.0f;
- texMtx[1][3] = tilingT + (-_0x44_x_0x30) * (sin * fS2 + cos * fT2);
+ texMtx[1][3] = tilingT + (-_0x44_x_0x30 * (sin * (tilingS + _0x38_x_0x24) + cos * (tilingT + _0x3C_x_0x28)));
texMtx[2][0] = 0.0f;
texMtx[2][1] = 0.0f;
- texMtx[2][2] = 0.0f;
- texMtx[2][3] = 1.0f;
+ texMtx[2][2] = 1.0f;
+ texMtx[2][3] = 0.0f;
GXLoadTexMtxImm(texMtx, 0x24, GX_MTX2x4);
}