coastline 0.0.4
Loading...
Searching...
No Matches
visgrid.h File Reference

The grid of the cells of the track the view frustum covers, which decides what is drawn. More...

#include "common/types.h"
#include "common/vecmath.h"
Include dependency graph for visgrid.h:

Go to the source code of this file.

Macros

#define VISIBLE_GRID_SIZE   64
 The cells along each side of the grid.
#define FRUSTUM_POINTS   6
#define FRUSTUM_CAMERA   0
#define FRUSTUM_RIGHT_TOP   1
#define FRUSTUM_LEFT_TOP   2
#define FRUSTUM_LEFT_BOTTOM   3
#define FRUSTUM_RIGHT_BOTTOM   4
#define FRUSTUM_FAR   5

Functions

void MarkVisibleCell (s32 col, s32 row)
 Widen the covered columns of a row to take in a cell, clamped to the grid.
void MarkVisibleEdge (f32 x0, f32 y0, f32 x1, f32 y1)
 Mark the cells a line between two points of the track passes through.
s32 IsCellVisible (s32 col, s32 row)
 Whether a cell is covered.
s32 IsPointVisible (f32 x, f32 y)
 Whether the cell under a point of the track is covered.
void BuildVisibleGrid (void)
 Build the grid from the edges of the view frustum.

Variables

Vec3f g_avFrustumPoints [FRUSTUM_POINTS]
 The camera and five far-plane points of the view frustum.
s32 g_dwVisibleGridMinCol
 The bounds of the covered cells.
s32 g_dwVisibleGridMinRow
 The first row of the cells covered by the view frustum.
s32 g_dwVisibleGridMaxCol
 The last column of the cells covered by the view frustum.
s32 g_dwVisibleGridMaxRow
 The last row of the cells covered by the view frustum.
s32 g_adwVisibleGridRowMinCol [VISIBLE_GRID_SIZE]
 The first covered column of each row.
s32 g_adwVisibleGridRowMaxCol [VISIBLE_GRID_SIZE]
 The last covered column of each row.
s32 g_adwVisibleGridColMinRow [VISIBLE_GRID_SIZE]
 The first covered row of each column.
s32 g_adwVisibleGridColMaxRow [VISIBLE_GRID_SIZE]
 The last covered row of each column.

Detailed Description

The grid of the cells of the track the view frustum covers, which decides what is drawn.

Macro Definition Documentation

◆ VISIBLE_GRID_SIZE

#define VISIBLE_GRID_SIZE   64

The cells along each side of the grid.

◆ FRUSTUM_POINTS

#define FRUSTUM_POINTS   6

The number of points of the frustum.

◆ FRUSTUM_CAMERA

#define FRUSTUM_CAMERA   0

The point of the camera.

◆ FRUSTUM_RIGHT_TOP

#define FRUSTUM_RIGHT_TOP   1

The far corner at the top right.

◆ FRUSTUM_LEFT_TOP

#define FRUSTUM_LEFT_TOP   2

The far corner at the top left.

◆ FRUSTUM_LEFT_BOTTOM

#define FRUSTUM_LEFT_BOTTOM   3

The far corner at the bottom left.

◆ FRUSTUM_RIGHT_BOTTOM

#define FRUSTUM_RIGHT_BOTTOM   4

The far corner at the bottom right.

◆ FRUSTUM_FAR

#define FRUSTUM_FAR   5

The centre of the far plane.

Function Documentation

◆ MarkVisibleCell()

void MarkVisibleCell ( s32 col,
s32 row )

Widen the covered columns of a row to take in a cell, clamped to the grid.

Parameters
colThe column of the cell.
rowThe row of the cell.
Ghidra address:
USA: 0x8022d090
Ghidra address:
Asia: 0x8022CBE0
Ghidra address:
EUR: 0x8022e5a0
Ghidra address:
JPN: 0x8022dd50
Ghidra address:
BRD3D: 0x1003a660
Ghidra address:
BRGlide: 0x10033ce0

◆ MarkVisibleEdge()

void MarkVisibleEdge ( f32 x0,
f32 y0,
f32 x1,
f32 y1 )

Mark the cells a line between two points of the track passes through.

Parameters
x0The X coordinate of the first point.
y0The Y coordinate of the first point.
x1The X coordinate of the second point.
y1The Y coordinate of the second point.
Ghidra address:
USA: 0x8022d104
Ghidra address:
Asia: 0x8022CC54
Ghidra address:
EUR: 0x8022e614
Ghidra address:
JPN: 0x8022ddc4
Ghidra address:
BRD3D: 0x1003a6b0
Ghidra address:
BRGlide: 0x10033d30

◆ IsCellVisible()

s32 IsCellVisible ( s32 col,
s32 row )

Whether a cell is covered.

Parameters
colThe column of the cell.
rowThe row of the cell.
Returns
Non-zero when the cell is covered.
Ghidra address:
USA: 0x8022d3d4
Ghidra address:
Asia: 0x8022CF24
Ghidra address:
EUR: 0x8022e8e4
Ghidra address:
JPN: 0x8022e094
Ghidra address:
BRD3D: 0x1003a910
Ghidra address:
BRGlide: 0x10033f90

◆ IsPointVisible()

s32 IsPointVisible ( f32 x,
f32 y )

Whether the cell under a point of the track is covered.

Parameters
xThe X coordinate of the point.
yThe Y coordinate of the point.
Returns
Non-zero when the cell is covered.
Ghidra address:
USA: 0x8022d43c
Ghidra address:
Asia: 0x8022CF8C
Ghidra address:
EUR: 0x8022e94c
Ghidra address:
JPN: 0x8022e0fc
Ghidra address:
BRD3D: 0x1003a950
Ghidra address:
BRGlide: 0x10033fd0

◆ BuildVisibleGrid()

void BuildVisibleGrid ( void )

Build the grid from the edges of the view frustum.

Ghidra address:
USA: 0x8022d49c
Ghidra address:
Asia: 0x8022CFEC
Ghidra address:
EUR: 0x8022e9ac
Ghidra address:
JPN: 0x8022e15c
Ghidra address:
BRD3D: 0x1003a990
Ghidra address:
BRGlide: 0x10034010

Variable Documentation

◆ g_avFrustumPoints

Vec3f g_avFrustumPoints[FRUSTUM_POINTS]
extern

The camera and five far-plane points of the view frustum.

Ghidra address:
USA: 0x8031b1f0
Ghidra address:
Asia: 0x8031ACA0
Ghidra address:
EUR: 0x8031d6f0
Ghidra address:
JPN: 0x8031c320
Ghidra address:
BRD3D: 0x106c3310
Ghidra address:
BRGlide: 0x106ea3a0

◆ g_dwVisibleGridMinCol

s32 g_dwVisibleGridMinCol
extern

The bounds of the covered cells.

Ghidra address:
USA: 0x8028bd90
Ghidra address:
Asia: 0x8028B8E0
Ghidra address:
EUR: 0x8028e4f0
Ghidra address:
JPN: 0x8028df20
Ghidra address:
BRD3D: 0x10a9bbc8
Ghidra address:
BRGlide: 0x10ac2c58

◆ g_dwVisibleGridMinRow

s32 g_dwVisibleGridMinRow
extern

The first row of the cells covered by the view frustum.

Ghidra address:
USA: 0x8028bd94
Ghidra address:
Asia: 0x8028B8E4
Ghidra address:
EUR: 0x8028e4f4
Ghidra address:
JPN: 0x8028df24
Ghidra address:
BRD3D: 0x10a9bbcc
Ghidra address:
BRGlide: 0x10ac2c5c

◆ g_dwVisibleGridMaxCol

s32 g_dwVisibleGridMaxCol
extern

The last column of the cells covered by the view frustum.

Ghidra address:
USA: 0x8028bd98
Ghidra address:
Asia: 0x8028B8E8
Ghidra address:
EUR: 0x8028e4f8
Ghidra address:
JPN: 0x8028df28
Ghidra address:
BRD3D: 0x10a9bbc0
Ghidra address:
BRGlide: 0x10ac2c50

◆ g_dwVisibleGridMaxRow

s32 g_dwVisibleGridMaxRow
extern

The last row of the cells covered by the view frustum.

Ghidra address:
USA: 0x8028bd9c
Ghidra address:
Asia: 0x8028B8EC
Ghidra address:
EUR: 0x8028e4fc
Ghidra address:
JPN: 0x8028df2c
Ghidra address:
BRD3D: 0x10a9bbc4
Ghidra address:
BRGlide: 0x10ac2c54

◆ g_adwVisibleGridRowMinCol

s32 g_adwVisibleGridRowMinCol[VISIBLE_GRID_SIZE]
extern

The first covered column of each row.

Ghidra address:
USA: 0x8034e5b0
Ghidra address:
Asia: 0x8034E060
Ghidra address:
EUR: 0x80350ab0
Ghidra address:
JPN: 0x8034eb30
Ghidra address:
BRD3D: 0x10a9bbd0
Ghidra address:
BRGlide: 0x10ac2c60

◆ g_adwVisibleGridRowMaxCol

s32 g_adwVisibleGridRowMaxCol[VISIBLE_GRID_SIZE]
extern

The last covered column of each row.

Ghidra address:
USA: 0x8034e6b0
Ghidra address:
Asia: 0x8034E160
Ghidra address:
EUR: 0x80350bb0
Ghidra address:
JPN: 0x8034ec30
Ghidra address:
BRD3D: 0x10a9bcd0
Ghidra address:
BRGlide: 0x10ac2d60

◆ g_adwVisibleGridColMinRow

s32 g_adwVisibleGridColMinRow[VISIBLE_GRID_SIZE]
extern

The first covered row of each column.

Ghidra address:
USA: 0x8034e7b0
Ghidra address:
Asia: 0x8034E260
Ghidra address:
EUR: 0x80350cb0
Ghidra address:
JPN: 0x8034ed30
Ghidra address:
BRD3D: 0x10a9bdd0
Ghidra address:
BRGlide: 0x10ac2e60

◆ g_adwVisibleGridColMaxRow

s32 g_adwVisibleGridColMaxRow[VISIBLE_GRID_SIZE]
extern

The last covered row of each column.

Ghidra address:
USA: 0x8034e8b0
Ghidra address:
Asia: 0x8034E360
Ghidra address:
EUR: 0x80350db0
Ghidra address:
JPN: 0x8034ee30
Ghidra address:
BRD3D: 0x10a9bed0
Ghidra address:
BRGlide: 0x10ac2f60