summaryrefslogtreecommitdiff
path: root/src/nw4r/g3d/g3d_workmem.cpp
blob: 4e363d1595c02123a0d72aa1ad349a05ca5105d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "nw4r/g3d.h" // IWYU pragma: export

namespace nw4r {
namespace g3d {
namespace detail {
namespace workmem {
namespace {

union {
    u8 mem[WORKMEM_SIZE]; // at 0x0
    struct {
        math::_VEC3 tmpScale[WORKMEM_NUMTMPSCALE]; // at 0x0
        u32 mtxID[WORKMEM_NUMMTXID];               // at 0x6000
    };
    u8 byteCode[WORKMEM_NUMBYTECODE];                 // at 0x0
    MdlZ mdlZ[WORKMEM_NUMMDLZ];                       // at 0x0
    math::_MTX34 skinningMtx[WORKMEM_NUMSKINNINGMTX]; // at 0x0
    math::_MTX34 bbMtx[WORKMEM_NUMBBMTX];             // at 0x0
    u8 shpAnmResultBuf[WORKMEM_NUMSHPANMRESULT];      // at 0x0
} sTemp ALIGN_DECL(128);

} // namespace

math::VEC3 *GetScaleTemporary() {
    return static_cast<math::VEC3 *>(sTemp.tmpScale);
}

u32 *GetMtxIDTemporary() {
    return sTemp.mtxID;
}

MdlZ *GetMdlZTemporary() {
    return sTemp.mdlZ;
}

math::MTX34 *GetSkinningMtxTemporary() {
    return static_cast<math::MTX34 *>(sTemp.skinningMtx);
}

math::MTX34 *GetBillboardMtxTemporary() {
    return static_cast<math::MTX34 *>(sTemp.bbMtx);
}

ShpAnmResultBuf *GetShpAnmResultBufTemporary() {
    return reinterpret_cast<ShpAnmResultBuf *>(sTemp.shpAnmResultBuf);
}

} // namespace workmem
} // namespace detail
} // namespace g3d
} // namespace nw4r