summaryrefslogtreecommitdiff
path: root/src/m/m3d/m_scnleaf.cpp
blob: 1f0d5721d869f09ed7f503794ad3084862cb6a5a (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "m/m3d/m_scnleaf.h"

#include "m/m3d/m3d.h"

namespace m3d {

scnLeaf_c::scnLeaf_c() : mpScnLeaf(nullptr) {}

scnLeaf_c::~scnLeaf_c() {
    scnLeaf_c::remove();
}

void scnLeaf_c::remove() {
    if (mpScnLeaf != nullptr) {
        mpScnLeaf->Destroy();
        mpScnLeaf = nullptr;
    }
}

int scnLeaf_c::entry() {
    return pushBack(mpScnLeaf);
}

void scnLeaf_c::setOption(u32 flag, u32 set) {
    mpScnLeaf->SetScnObjOption(flag, set);
}

void scnLeaf_c::setScale(f32 x, f32 y, f32 z) {
    mpScnLeaf->SetScale(x, y, z);
}

void scnLeaf_c::setScale(const nw4r::math::VEC3 &scale) {
    mpScnLeaf->SetScale(scale);
}

void scnLeaf_c::getScale(nw4r::math::VEC3 *vec) const {
    mpScnLeaf->GetScale(vec);
}

void scnLeaf_c::setLocalMtx(const nw4r::math::MTX34 *mtx) {
    mpScnLeaf->SetMtx(nw4r::g3d::ScnObj::MTX_LOCAL, mtx);
}

void scnLeaf_c::getLocalMtx(nw4r::math::MTX34 *mtx) const {
    mpScnLeaf->GetMtx(nw4r::g3d::ScnObj::MTX_LOCAL, mtx);
}

const nw4r::math::MTX34 *scnLeaf_c::getLocalMtx() const {
    return mpScnLeaf->GetMtxPtr(nw4r::g3d::ScnObj::MTX_LOCAL);
}

void scnLeaf_c::getWorldMtx(nw4r::math::MTX34 *mtx) const {
    mpScnLeaf->GetMtx(nw4r::g3d::ScnObj::MTX_WORLD, mtx);
}

void scnLeaf_c::getViewMtx(nw4r::math::MTX34 *mtx) const {
    mpScnLeaf->GetMtx(nw4r::g3d::ScnObj::MTX_VIEW, mtx);
}

// unofficial
void scnLeaf_c::setCallback(nw4r::g3d::IScnObjCallback *cb) {
    mpScnLeaf->SetCallback(cb);
}

nw4r::g3d::IScnObjCallback *scnLeaf_c::swapCallback(nw4r::g3d::IScnObjCallback *cb) {
    nw4r::g3d::IScnObjCallback *tmp = mpScnLeaf->GetScnObjCallback();
    mpScnLeaf->SetCallback(cb);
    return tmp;
}

void scnLeaf_c::enableCallbackTiming(nw4r::g3d::ScnObj::Timing timing) {
    mpScnLeaf->EnableScnObjCallbackTiming(timing);
}

void scnLeaf_c::enableCallbackOp(nw4r::g3d::ScnObj::ExecOp op) {
    mpScnLeaf->EnableScnObjCallbackExecOp(op);
}

void scnLeaf_c::calc(bool b) {
    setOption(/* DISABLE_CALC_WORLD */ 0x02, false);
    mpScnLeaf->G3dProc(1, 0, nullptr);
    if (b == false) {
        setOption(/* DISABLE_CALC_WORLD */ 0x02, true);
    }
}

void scnLeaf_c::calcVtx(bool b) {
    setOption(/* DISABLE_CALC_VTX */ 0x04, false);
    mpScnLeaf->G3dProc(3, 0, nullptr);
    if (b == false) {
        setOption(/* DISABLE_CALC_VTX */ 0x04, true);
    }
}

/** Unknown name/arg type */
void scnLeaf_c::calcView(void *p, bool b) {
    setOption(/* DISABLE_CALC_VIEW */ 0x05, false);
    mpScnLeaf->G3dProc(4, 0, p);
    if (b == false) {
        setOption(/* DISABLE_CALC_VIEW */ 0x05, true);
    }
}

void scnLeaf_c::setPriorityDraw(int opa, int xlu) {
    mpScnLeaf->SetPriorityDrawOpa(opa);
    mpScnLeaf->SetPriorityDrawXlu(xlu);
}

} // namespace m3d