summaryrefslogtreecommitdiff
path: root/include/m/m3d/m_bline.h
blob: 7e4a26f26ae0ae876f85bf8a6ead709ba9dccdaa (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
#ifndef M3D_BLINE_H
#define M3D_BLINE_H

#include "common.h"
#include "egg/gfx/eggTexture.h"
#include "m/m3d/m_proc.h"
#include "m/m_math.h"
#include "m/m_vec.h"
#include "nw4r/ut/ut_Color.h"

namespace m3d {

// The Actual line
class bline_c {
public:
    bline_c() : mpPathArr(nullptr), mpVtxPosArr(nullptr), mpVtxNrmArr(nullptr), mpVtxTexArr(nullptr), mFlags(0) {}
    // This is mainly a Guess, When the array is created, it has both a ctor/dtor
    struct VtxPos {
        mVec3_c pos1;
        mVec3_c pos2;
    };
    struct Vec3u8 {
        Vec3u8() {}
        u8 x, y, z;
    };
    // This is mainly a Guess, When the array is created, it has only a ctor
    struct VtxNrm {
        Vec3u8 nrm1;
        Vec3u8 nrm2;
    };
    // This is mainly a Guess, When the array is created, it doesnt use the array alloc
    struct VtxTex {
        f32 tex;
    };

    /* 0x00 */ u8 field_0x00[0x8];

    bool create(EGG::Heap *pHeap, u16 numPts, f32 width, f32 repeat, const nw4r::ut::Color &color);
    void update(mVec3_c *startPos);
    void remove();
    void draw();

    mVec3_c &getPathPoint(u16 idx) {
        return mpPathArr[idx];
    }

    // vt at 0x08
    virtual ~bline_c();

    /* 0x0C */ f32 mWidth; // could be a scale too
    /* 0x10 */ nw4r::ut::Color mColor;
    /* 0x14 */ mVec3_c *mpPathArr;
    /* 0x18 */ VtxPos *mpVtxPosArr;
    /* 0x1C */ VtxNrm *mpVtxNrmArr;
    /* 0x20 */ VtxTex *mpVtxTexArr;
    /* 0x24 */ f32 mTexRepeat; // Higher value causes the texture to repeat more often
    /* 0x28 */ u16 mPathNum;   // Guess
    /* 0x2A */ u16 mVtxNum;    // Guess
    /* 0x2C */ u16 field_0x2C;
    /* 0x2E */ u8 mFlags;
    /* 0x2F    u8 _pad; */
};

class blineMat_c : public proc_c {
public:
    blineMat_c() : mpLineArr(nullptr) {}
    virtual ~blineMat_c();
    virtual void remove() override;
    virtual void drawOpa() override;
    virtual void drawXlu() override;
    virtual void setupGX(bool bTransparent);

    bool create(
        mAllocator_c *pAllocator, int numLines, u16 numLinePts, f32 width, f32 repeat, nw4r::ut::Color &color,
        EGG::ResTIMG *pTex, bool
    );
    void update();
    bline_c *getLine(u16 idx);

    /* 0x1C */ mAllocator_c mAllocator;
    /* 0x34 */ EGG::ResTIMG *mpTex;
    /* 0x38 */ nw4r::ut::List mLines;
    /* 0x44 */ bline_c *mpLineArr;
    /* 0x48 */ short mLineArrNum;
    /* 0x4A */ bool field_0x4A;
};

} // namespace m3d

#endif