MCPcopy Create free account
hub / github.com/doldecomp/mkdd / calc

Method calc

src/Osako/shadowModel.cpp:14–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14void KartShadowModel::calc()
15{
16 Mtx r_m, s_m;
17 const Mtx &modelMtx = mModel[0]->getBaseTRMtx();
18 const Vec up = {0.0f, 1.0f, 0.0f};
19
20 PSMTXScale(s_m, mScaleX, 1.0f, mScaleY);
21 /*(180.0f / PI) */
22 PSMTXRotAxisRad(r_m, &up, MTXDegToRad(57.29578f * std::atan2f(modelMtx[0][2], modelMtx[2][2])));
23 PSMTXConcat(r_m, s_m, r_m);
24
25 f32 x, y, z; // fakematch?
26
27 x = modelMtx[0][3];
28 z = modelMtx[2][3];
29 y = modelMtx[1][3];
30
31 r_m[0][3] = x;
32 r_m[1][3] = y;
33 r_m[2][3] = z;
34
35 mModel[0]->setBaseTRMtx(r_m);
36
37 f32 roll = mRoll / (3.14f/2.0f);
38
39 for (; roll > 3.0f; roll -= 2.0f)
40 ;
41 for (; roll < -3.0f; roll += 2.0f)
42 ;
43
44 if (roll > 1.0f)
45 roll = 2.0f - roll;
46 if (roll < -1.0f)
47 roll = roll + 2.0f;
48 roll *= 10.0f;
49
50 mAnmCluster->setFrame(10.0f + roll);
51 mModel[0]->getBaseTRMtx()[1][3] = mPosY;
52 ExModel::calc();
53}
54
55bool KartShadowModel::createModel(JKRSolidHeap *heap, u32 p2, u32 p3)
56{

Callers

nothing calls this directly

Calls 4

calcFunction · 0.70
atan2fFunction · 0.50
setBaseTRMtxMethod · 0.45
setFrameMethod · 0.45

Tested by

no test coverage detected