forked from zeldaret/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJ3DVertex.h
More file actions
155 lines (130 loc) · 4.52 KB
/
J3DVertex.h
File metadata and controls
155 lines (130 loc) · 4.52 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#ifndef J3DVERTEX_H
#define J3DVERTEX_H
#include <dolphin/gx.h>
#include "dolphin/mtx.h"
typedef struct _GXColor GXColor;
class J3DModel;
class J3DAnmVtxColor;
class J3DVertexBuffer;
/**
* @ingroup jsystem-j3d
*
*/
struct J3DVtxColorCalc {
/* 8032E180 */ void calc(J3DModel*);
virtual void calc(J3DVertexBuffer*);
/* 0x0 */ void* vtable; // inlined vtable?
/* 0x4 */ u32 mFlags;
/* 0x8 */ J3DAnmVtxColor* mpVtxColor;
};
/**
* @ingroup jsystem-j3d
*
*/
class J3DVertexData {
public:
J3DVertexData();
void* getVtxPosArray() const { return mVtxPosArray; }
void* getVtxNrmArray() const { return mVtxNrmArray; }
GXColor* getVtxColorArray(u8 idx) const { return mVtxColorArray[idx]; }
void* getVtxTexCoordArray(u8 idx) const { return mVtxTexCoordArray[idx]; }
void* getVtxNBTArray() const { return mVtxNBTArray; }
u32 getNrmNum() const { return mNrmNum; }
u32 getVtxNum() const { return mVtxNum; }
GXVtxAttrFmtList* getVtxAttrFmtList() { return mVtxAttrFmtList; }
u8 getVtxPosFrac() { return mVtxPosFrac; }
u8 getVtxNrmFrac() { return mVtxNrmFrac; }
int getVtxPosType() { return mVtxPosType; }
int getVtxNrmType() { return mVtxNrmType; }
void setVtxPosFrac(u8 frac) { mVtxPosFrac = frac; }
void setVtxPosType(GXCompType type) { mVtxPosType = type; }
void setVtxNrmFrac(u8 frac) { mVtxNrmFrac = frac; }
void setVtxNrmType(GXCompType type) { mVtxNrmType = type; }
private:
friend class J3DModelLoader;
/* 0x00 */ u32 mVtxNum;
/* 0x04 */ u32 mNrmNum;
/* 0x08 */ u32 mColNum;
/* 0x0C */ u32 mTexCoordNum;
/* 0x10 */ u32 mPacketNum;
/* 0x14 */ GXVtxAttrFmtList* mVtxAttrFmtList;
/* 0x18 */ void* mVtxPosArray;
/* 0x1C */ void* mVtxNrmArray;
/* 0x20 */ void* mVtxNBTArray;
/* 0x24 */ GXColor* mVtxColorArray[2];
/* 0x2C */ void* mVtxTexCoordArray[8];
/* 0x4C */ u8 mVtxPosFrac;
/* 0x50 */ GXCompType mVtxPosType;
/* 0x54 */ u8 mVtxNrmFrac;
/* 0x58 */ GXCompType mVtxNrmType;
};
/**
* @ingroup jsystem-j3d
*
*/
class J3DVertexBuffer {
public:
J3DVertexBuffer() { init(); }
/* 80310F78 */ void setVertexData(J3DVertexData*);
/* 80310FD8 */ void init();
/* 80311030 */ ~J3DVertexBuffer();
/* 8031106C */ void setArray() const;
/* 80311090 */ s32 copyLocalVtxPosArray(u32);
/* 803111B0 */ s32 copyLocalVtxNrmArray(u32);
/* 803112D0 */ s32 copyLocalVtxArray(u32);
/* 80311478 */ s32 allocTransformedVtxPosArray();
/* 8031152C */ s32 allocTransformedVtxNrmArray();
void setCurrentVtxPos(void* pVtxPos) { mCurrentVtxPos = pVtxPos; }
void* getCurrentVtxPos() { return mCurrentVtxPos; }
void setCurrentVtxNrm(void* pVtxNrm) { mCurrentVtxNrm = pVtxNrm; }
void* getCurrentVtxNrm() { return mCurrentVtxNrm; }
void setCurrentVtxCol(GXColor* pVtxCol) { mCurrentVtxCol = pVtxCol; }
void frameInit() {
setCurrentVtxPos(mVtxPosArray[0]);
setCurrentVtxNrm(mVtxNrmArray[0]);
setCurrentVtxCol(mVtxColArray[0]);
}
void* getTransformedVtxPos(int idx) { return mTransformedVtxPosArray[idx]; }
void* getTransformedVtxNrm(int idx) { return mTransformedVtxNrmArray[idx]; }
J3DVertexData* getVertexData() const { return mVtxData; }
void swapTransformedVtxPos() {
void* tmp = mTransformedVtxPosArray[0];
mTransformedVtxPosArray[0] = mTransformedVtxPosArray[1];
mTransformedVtxPosArray[1] = tmp;
}
void swapTransformedVtxNrm() {
void* tmp = mTransformedVtxNrmArray[0];
mTransformedVtxNrmArray[0] = mTransformedVtxNrmArray[1];
mTransformedVtxNrmArray[1] = tmp;
}
void swapVtxPosArrayPointer() {
void* temp = mVtxPosArray[0];
mVtxPosArray[0] = mVtxPosArray[1];
mVtxPosArray[1] = temp;
}
void swapVtxNrmArrayPointer() {
void* temp = mVtxNrmArray[0];
mVtxNrmArray[0] = mVtxNrmArray[1];
mVtxNrmArray[1] = temp;
}
void* getVtxPosArrayPointer(int index) {
return mVtxPosArray[index];
}
void* getVtxNrmArrayPointer(int index) {
return mVtxNrmArray[index];
}
private:
/* 0x00 */ J3DVertexData* mVtxData;
/* 0x04 */ void* mVtxPosArray[2];
/* 0x0C */ void* mVtxNrmArray[2];
/* 0x14 */ GXColor* mVtxColArray[2];
/* 0x1C */ void* mTransformedVtxPosArray[2];
/* 0x24 */ void* mTransformedVtxNrmArray[2];
/* 0x2C */ void* mCurrentVtxPos;
/* 0x30 */ void* mCurrentVtxNrm;
/* 0x34 */ GXColor* mCurrentVtxCol;
}; // Size: 0x38
struct VertexNormal {
Vec data;
};
#endif /* J3DVERTEX_H */