summaryrefslogtreecommitdiff
path: root/include/egg/gfx/eggModelEx.h
blob: 9e8aa23fde04f790f112c3834023e220dc3f286d (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
#ifndef EGG_MODEL_EX_H
#define EGG_MODEL_EX_H

#include "common.h"
#include "egg/egg_types.h"
#include "nw4r/g3d/g3d_scnobj.h"
#include "nw4r/g3d/res/g3d_resmdl.h"
namespace EGG {

class ModelEx {
public:
    enum EType {
        cType_ScnMdlSimple,
        cType_ScnMdl,
        cType_ScnMdl1Mat1Shp,
        cType_ScnProcModel,
        cType_ScnRfl,
        cType_None
    };

    enum EFlag {
        cFlag_HasOriginalBV = (1 << 0)
    };

    enum EDrawShape {
        cDrawShape_None = (1 << 0)
    };

private:
    nw4r::g3d::ScnObj *mScnObj;        // at 0x0
    EType mType;                       // at 0x4
    u16 mFlag;                         // at 0x8
    ModelBoundingInfo *mpBoundingInfo; // at 0xC

    static u32 sDrawFlag;
    static const char *sByteCodeCalcStr;
    static const char *sByteCodeMixStr;

public:
    ModelEx(nw4r::g3d::ScnObj *);
    void getShapeMinMax(u16, nw4r::math::VEC3 *, nw4r::math::VEC3 *, bool);
    void calcWorld(nw4r::math::MTX34 *, const nw4r::math::MTX34 *worldMtx) const;
    nw4r::g3d::ResMdl getResMdl() const;
    nw4r::g3d::ResShp getResShp(u16) const;

    nw4r::g3d::ScnMdl *getScnMdl() const {
        return (mType == cType_ScnMdl) ? (nw4r::g3d::ScnMdl *)mScnObj : NULL;
    }

    nw4r::g3d::ScnMdlSimple *getScnMdlSimple() const {
        return (mType == cType_ScnMdlSimple || mType == cType_ScnMdl) ? (nw4r::g3d::ScnMdlSimple *)mScnObj : NULL;
    }

    nw4r::g3d::ScnMdl1Mat1Shp *getScnMdl1Mat1Shp() const {
        return (mType == cType_ScnMdl1Mat1Shp) ? (nw4r::g3d::ScnMdl1Mat1Shp *)mScnObj : NULL;
    }

    void getMtxType0(nw4r::math::MTX34 *pMtx) const {
        nw4r::math::MTX34Copy(pMtx, mScnObj->GetMtxPtr(nw4r::g3d::ScnObj::MTX_LOCAL));
    }
};

} // namespace EGG

#endif