coastline 0.0.4
Loading...
Searching...
No Matches
model.h
Go to the documentation of this file.
1#ifndef COASTLINE_MODEL_H
2#define COASTLINE_MODEL_H
3
8
9#include <PR/gbi.h>
10#include <PR/ultratypes.h>
11
12#include "common/ptr32.h"
13#include "common/vecmath.h"
14
15#if TGR_BOSS_RALLY
16#include "common/gbicommand.h"
17#endif
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24typedef struct {
25#if TGR_BOSS_RALLY
27#else
29#endif
32} ModelPart;
33
35#define MODEL_PART_LIGHT_RAMP 0x0003
36
38#define MODEL_PART_TWO_SIDED 0x0004
39
41#define MODEL_PART_TRANSLUCENT 0x0008
42
44#define MODEL_PART_FLAT 0x0080
45
47#define MODEL_PART_RAMPED 0x0400
48
53typedef struct {
57
58/* The flags of an animation. */
59#define MODEL_ANIMATION_REPEAT 0x1
60#define MODEL_ANIMATION_BOUNCE 0x2
61#define MODEL_ANIMATION_REVERSING 0x4
62
80
86
91typedef struct Model {
92#if TGR_BOSS_RALLY
93 u16 wUnknown0;
95#else
97#endif
101
111
121
133
144extern u32 g_adwModelShadeColors[4];
145
158void DrawModelList(Model *model, f32 m[4][4]);
159
174void DrawRotatedModel(Model *model, f32 x, f32 y, f32 z, f32 angle);
175
191void DrawModelAt(Model *model, f32 x, f32 y, f32 z, f32 angle, f32 scale);
192
206#if TGR_BOSS_RALLY
207Model *DecompressModel(void *dst, const char *source);
208#else
209#ifdef COASTLINE_ROM_POINTERS
210Model *DecompressModel(void *dst, char *source);
211#else
212Model *DecompressModel(void *dst, u32 source);
213#endif
214#endif
215
230void RemapPointer(u32 *pointer, const void *lo, const void *hi, const void *base);
231
247void FixupDisplayListPointers(Gfx *displayList, const void *lo, const void *hi, const void *base);
248
261
275
289void SetModelAnimationFlags(Model *model, s32 set, s32 clear);
290
303
317
330
343Model *DmaReadAndFixupTrackModel(void *dst, u32 romStart, u32 romEnd);
344
345#ifdef __cplusplus
346}
347#endif
348
349#endif /* COASTLINE_MODEL_H */
The graphics binary interface types the gu routines fill in for the RSP microcode.
void RelocateModelPointers(Model *model)
Turn the offsets a model is loaded with into pointers: its animations, their vertices and keys,...
void RemapPointer(u32 *pointer, const void *lo, const void *hi, const void *base)
Move a pointer that falls in a range of offsets to the same place from a base.
void BounceModelAnimations(Model *model)
Make every animation of a model repeat by turning back at its end.
void PlayModelAnimationsOnce(Model *model)
Make the animations of a model stop at their ends rather than repeat.
void DrawModelAt(Model *model, f32 x, f32 y, f32 z, f32 angle, f32 scale)
Draw a model turned about its own axis by an angle in radians, scaled, stood up and placed at a posit...
Model * DmaReadAndFixupTrackModel(void *dst, u32 romStart, u32 romEnd)
Read a model from the cartridge and turn its offsets into pointers.
void DrawModelList(Model *model, f32 m[4][4])
Draw the parts of a model, the opaque ones first, under a matrix.
Model * DecompressModel(void *dst, u32 source)
Load a model into a buffer and turn its offsets into pointers.
void FixupDisplayListPointers(Gfx *displayList, const void *lo, const void *hi, const void *base)
Remap the addresses of the vertices and textures of a display list, up to its end.
void DrawRotatedModel(Model *model, f32 x, f32 y, f32 z, f32 angle)
Draw a model turned about its own axis by an angle in radians, at a 32nd of its size,...
void AdvanceModelAnimations(Model *model)
Advance every animation of a model by the time of the frame, blending its vertices between keyframes.
s32 g_dwDrawModelListNoZBuffer
Whether DrawModelList() draws without the depth buffer.
void SetModelAnimationFlags(Model *model, s32 set, s32 clear)
Set flags on every animation of a model, then clear others.
Light g_MenuDirectionalLight
The directional light of the menus that draw models.
u32 g_adwModelShadeColors[4]
The light of the parts of a model lit by their light ramp, by its index.
Ambient g_MenuAmbientLight
The ambient light of the menus that draw models.
void LoopModelAnimations(Model *model)
Make every animation of a model wrap to its start at its end, instead of turning back.
Pointers of 32 bits in the data the game reads from files and in its display lists.
#define TGR_PTR(T)
A pointer of 32 bits to T.
Definition ptr32.h:152
A command of a display list of the game.
Definition gbicommand.h:30
The animations of a model.
Definition model.h:82
s32 count
Definition model.h:83
ModelAnimation * entries[]
Definition model.h:84
An animation of vertices of a model, blended between its keys.
Definition model.h:64
u16 startKey
Definition model.h:74
Vtx * vertices
Definition model.h:69
void * unreconstructed8
Definition model.h:71
s32 keyCount
Definition model.h:72
s32 vertexCount
Definition model.h:65
f32 time
Definition model.h:77
f32 endTime
Definition model.h:76
ModelKeyframe * keys[]
Definition model.h:78
u16 flags
Definition model.h:73
f32 startTime
Definition model.h:75
A key of an animation: its time, then the position of each vertex, then its normal.
Definition model.h:53
s16 positions[][3]
Definition model.h:55
f32 time
Definition model.h:54
A part of a model: its display list, how it is drawn, and where.
Definition model.h:24
Vec3f position
Definition model.h:31
u16 flags
Definition model.h:30
Gfx * displayList
Definition model.h:28
A model loaded from the cartridge, with its display lists and the animations of its parts.
Definition model.h:91
ModelAnimationList * animations
Definition model.h:98
u32 partCount
Definition model.h:96
ModelPart parts[]
Definition model.h:99
A point or direction in space.
Definition vecmath.h:17
Integer and floating-point types of libultra.
unsigned int u32
Definition ultratypes.h:20
short s16
Definition ultratypes.h:24
float f32
Definition ultratypes.h:38
unsigned short u16
Definition ultratypes.h:19
int s32
Definition ultratypes.h:25
An ambient light, aligned for the RSP.
Definition gbi.h:439
A display list command for the Fast3D microcode.
Definition gbi.h:132
A directional light, aligned for the RSP.
Definition gbi.h:33
The source or converted vertex data referenced by a display-list command.
Definition gbicommand.h:24
A vertex for the RSP, with a colour or with a normal.
Definition gbi.h:75
The vector and matrix arithmetic of the game, its arctangent and power, the triangle and segment test...