22
33#include <ctr/macros.h>
44#include <ctr/math.h>
5+ #include <ctr/prim.h>
6+
7+ #define NUM_VERTICES_QUADBLOCK 9
8+ #define NUM_VERTICES_TRIANGLE 3
59
610typedef union Color
711{
@@ -15,10 +19,98 @@ typedef union Color
1519 u32 color ;
1620} Color ;
1721
22+ typedef struct TextureLayout
23+ {
24+ UV uv0 ;
25+ CLUT clut ;
26+ UV uv1 ;
27+ PolyTexpage texpage ;
28+ UV uv2 ;
29+ UV uv3 ;
30+ } TextureLayout ;
31+
32+ typedef struct TextureGroup
33+ {
34+ TextureLayout far ;
35+ TextureLayout middle ;
36+ TextureLayout near ;
37+ TextureLayout mosaic ;
38+ } TextureGroup ;
39+
1840typedef struct Vertex
1941{
2042 SVec3 pos ;
2143 u16 flags ;
2244 Color colorHi ;
2345 Color colorLo ;
24- } Vertex ;
46+ } Vertex ;
47+
48+ typedef struct VisibleSet
49+ {
50+ u32 * visibleBSPNodes ;
51+ u32 * visibleQuadblocks ;
52+ u32 * visibleInstances ;
53+ u32 * visibleExtra ;
54+ } VisibleSet ;
55+
56+ typedef struct Quadblock
57+ {
58+ u16 index [NUM_VERTICES_QUADBLOCK ]; // 0x0
59+ u16 flags ; // 0x12
60+ u32 drawOrderLow ; // 0x14
61+ u32 drawOrderHigh ; // 0x18
62+ u32 offMidTextures [4 ]; // 0x1C
63+ BoundingBox bbox ; // 0x2C
64+ u8 terrain ; // 0x38
65+ u8 weatherIntensity ; // 0x39
66+ u8 weatherVanishRate ; // 0x3A
67+ s8 speedImpact ; // 0x3B
68+ u16 id ; // 0x3C
69+ u8 checkpointIndex ; // 0x3E
70+ u8 triNormalVecBitshift ; // 0x3F
71+ u32 offLowTexture ; // 0x40
72+ VisibleSet visibleSet ; // 0x44
73+ u16 triNormalVecDividend [NUM_VERTICES_QUADBLOCK + 1 ]; // 0x48
74+ } Quadblock ;
75+
76+ typedef struct BSPBranch
77+ {
78+ u16 flags ; // 0x0
79+ u16 id ; // 0x2
80+ BoundingBox bbox ; // 0x4
81+ SVec3 axis ; // 0x10
82+ u16 likelyPadding ; // 0x16
83+ u16 leftChildID ; // 0x18
84+ u16 rightChildID ; // 0x1A
85+ u16 unk1 ; // 0x1C
86+ u16 unk2 ; // 0x1E
87+ } BSPBranch ;
88+
89+ typedef struct BSPLeaf
90+ {
91+ u16 flags ; // 0x0
92+ u16 id ; // 0x2
93+ BoundingBox bbox ; // 0x4
94+ u32 likelyPadding ; // 0x10
95+ u32 offHitbox ; // 0x14
96+ u32 numQuads ; // 0x18
97+ Quadblock * quadblocks ; // 0x1C
98+ } BSPLeaf ;
99+
100+ typedef union BSPNode
101+ {
102+ BSPBranch branch ;
103+ BSPLeaf leaf ;
104+ } BSPNode ;
105+
106+ typedef struct MeshInfo
107+ {
108+ u32 numQuadblocks ; // 0x0
109+ u32 numVertices ; // 0x4
110+ u32 unk1 ; // 0x8
111+ Quadblock * quadblocks ; // 0xC
112+ Vertex * vertices ; // 0x10
113+ u32 unk2 ; // 0x14
114+ BSPNode * bspNodes ; // 0x18
115+ u32 numBSPNodes ; // 0x1C
116+ } MeshInfo ;
0 commit comments