coastline 0.0.4
Loading...
Searching...
No Matches
trackrender.h
Go to the documentation of this file.
1#ifndef COASTLINE_TRACKRENDER_H
2#define COASTLINE_TRACKRENDER_H
3
9
10#include <PR/gbi.h>
11#include <PR/ultratypes.h>
12
14#include "common/vecmath.h"
15#include "common/vehicle.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#if !TGR_BOSS_RALLY
31
44#endif /* !TGR_BOSS_RALLY */
45
47typedef struct {
52
54#define VISIBLE_CELLS 192
55
66
67#if !TGR_BOSS_RALLY
78#endif /* !TGR_BOSS_RALLY */
79
91
104
117
129
141
142#if !TGR_BOSS_RALLY
155#endif /* !TGR_BOSS_RALLY */
156
158#if !TGR_BOSS_RALLY
169extern s32 g_nTrackTransparentStartIdxNear;
170#endif /* !TGR_BOSS_RALLY */
171
172#if !TGR_BOSS_RALLY
181extern s32 g_nTrackTransparentStartIdxFar;
182#endif /* !TGR_BOSS_RALLY */
184
185#if !TGR_BOSS_RALLY
195#endif /* !TGR_BOSS_RALLY */
196
197#if !TGR_BOSS_RALLY
207#endif /* !TGR_BOSS_RALLY */
208
220
221#if !TGR_BOSS_RALLY
233#endif /* !TGR_BOSS_RALLY */
234
246
258
259#if !TGR_BOSS_RALLY
270#endif /* !TGR_BOSS_RALLY */
271
282
293
304
305#if !TGR_BOSS_RALLY
315#endif /* !TGR_BOSS_RALLY */
316
327extern LookAt *g_pTrackLookAt;
328
339extern Lights1 g_aTrackLights[4];
340
352
363
375
376#if !TGR_BOSS_RALLY
384extern const f32 g_fShadowLengthScale;
385
393extern const f32 g_fShadowWidthScale;
394#endif
395
396#if TGR_BOSS_RALLY
408 const ViewportRect *viewports, const Vec3f *point, s32 size, s16 low[2], s16 high[2]);
409#else
423void ProjectWorldToScreenRect(const Vec3f *point, s32 size, s16 low[2], s16 high[2]);
424#endif /* TGR_BOSS_RALLY */
425
426#if TGR_BOSS_RALLY
440 const ViewportRect *viewports, s32 index, s32 vehicles, s32 deferred, Vehicle *firstVehicle);
441#else
454void RenderTrackInstance(s32 index, s32 vehicles, s32 deferred);
455#endif /* TGR_BOSS_RALLY */
456
470s32 CompareVisibleCellDistance(const void *a, const void *b);
471
472#if TGR_BOSS_RALLY
481void BuildVisibleInstanceList(const ViewportRect *viewports,
482 const RacerSlot *slots,
483 const Vehicle *vehicles);
484#else
496#endif /* TGR_BOSS_RALLY */
497
498#if TGR_BOSS_RALLY
509void RenderTrackGeometry(const ViewportRect *viewports,
510 s32 deferred,
511 const RacerSlot *slots,
512 Vehicle *vehicles);
513#else
525#endif /* TGR_BOSS_RALLY */
526
527#ifdef __cplusplus
528}
529#endif
530
531#endif /* COASTLINE_TRACKRENDER_H */
#define MAX_VEHICLES
The capacity of the race engine's vehicle array.
Definition bossrallyvehicle.h:23
The graphics binary interface types the gu routines fill in for the RSP microcode.
An ambient light and one directional light.
Definition gbi.h:445
The two directions the RSP uses to generate texture coordinates for reflection mapping.
Definition gbi.h:39
The saved settings and progress of a player.
Definition profile.h:23
A racer of a race.
Definition racerslot.h:28
A point or direction in space.
Definition vecmath.h:17
A vehicle.
Definition vehicle.h:143
The rectangle of the screen a view fills.
Definition render.h:134
A cell of the grid of the track in view, and its squared distance from the camera in cells.
Definition trackrender.h:47
s16 distance
Definition trackrender.h:50
u8 row
Definition trackrender.h:49
u8 column
Definition trackrender.h:48
Lights1 g_aTrackLights[4]
The lights of the track, one of four in turn each frame.
Vec3f g_vShadowForward
The forward of the vehicle whose shadow is being cast, on the ground.
s32 g_bVisibleCellListOverflow
Whether the cells in view were more than VISIBLE_CELLS.
u32 g_dwTrackOtherModeLFlags
The render-mode flags applied with g_dwTrackOtherModeLBlend.
s32 g_nVisibleCellIdxMid
Where the middle-distance model group starts, or -1.
void BuildVisibleInstanceList(void)
List the placed models of the cells in view, the nearest cells first, mark the models the nearest veh...
u32 g_dwTrackOtherModeLBlend
The blender and the other bits of the render mode of the track.
s32 g_nVisibleInstanceCount
The placed models in view this frame.
LookAt * g_pTrackLookAt
The look-at of the reflections of the track.
s32 g_nVisibleCellIdxFar
Where the models of cells within three cells of the far plane start, or -1.
u8 g_abInstanceVisibilityMask[]
For each placed model: 0xFF until it is listed in view, then 0 with a bit for each vehicle near enoug...
s32 g_anNearbyVehicleIdx[MAX_VEHICLES]
The indices of the vehicles near enough to cast shadows on placed models.
s32 g_bShadowCullDisabled
Whether shadows include triangles outside their texture and extend beyond their vehicle's screen rect...
void RenderTrackInstance(s32 index, s32 vehicles, s32 deferred)
Draw a placed model, and on it the shadow of each vehicle in a mask, by its vertices taken to the tex...
Vec3f g_vTrackLightDirection
The direction of the light of the track.
void RenderTrackGeometry(s32 deferred)
Draw the placed models in view: in the first pass the opaque ones, leaving the translucent ones,...
VisibleCell g_aVisibleCellTuples[VISIBLE_CELLS+1]
The cells in view, the nearest first, ending with a column of 0xFF.
f32 g_fViewMatrixMaxAbs
The largest absolute value of the first three rows of g_afViewProjMatrix.
PlayerProfile * g_pActiveProfile
The profile used for the active season when selecting track instances.
s32 CompareVisibleCellDistance(const void *a, const void *b)
Order two cells in view by their distance from the camera.
const f32 g_fShadowWidthScale
Scale of the vehicle shadow across its width.
f32 g_afNearbyVehicleDot[MAX_VEHICLES]
How far ahead of the camera each one is.
#define VISIBLE_CELLS
The most cells in view, past which the farthest are left out.
Definition trackrender.h:54
const f32 g_fShadowLengthScale
Scale of the vehicle shadow along its length.
u32 g_dwInstanceHideFlags
The TRACK_INSTANCE_ flags of the placed models not drawn.
u16 g_wActiveInstanceHideMask
The groups of placed models hidden from the camera.
s32 g_nVisibleCellIdxNear
Where in the list of the models the cells start that are at least 3 cells from the camera,...
void ProjectWorldToScreenRect(const Vec3f *point, s32 size, s16 low[2], s16 high[2])
Take a point and a size around it to the corners of the rectangle of the screen they cover in the vie...
s32 g_nNearbyVehicleCount
The vehicles nearest the camera that cast shadows, nearest first.
s32 g_nDeferredInstanceLastIdx
The last translucent model left for the second pass, or -1.
Vec3f g_vVehicleVisibilityDelta
From the camera to a vehicle.
s32 g_nTrackTransparentStartIdx
Where the translucent models past g_nVisibleCellIdxMid start in the second pass, which draws them wit...
s32 g_nTrackLightBufferIndex
The index of the light buffer used to draw the track this frame.
s32 g_bDebugHideInstance
Whether g_nDebugHiddenInstanceIndex is left undrawn.
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
unsigned char u8
Definition ultratypes.h:18
The vector and matrix arithmetic of the game, its arctangent and power, the triangle and segment test...
The vehicles of a race, the cars they are, and their place on the track.