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

The cameras that follow each vehicle. More...

Include dependency graph for camera.h:

Go to the source code of this file.

Functions

void ResolveVehicleTrackCollision (Vehicle *vehicle, CameraFrame *camera, Vec3f *target)
 Keep a camera out of the track: if the line from the look-at point of a vehicle to the camera passes through a triangle, and so does the line from a target point, put the camera just in front of the triangle, no farther from the look-at point than it was.
void UpdateCameraChase (Vehicle *vehicle, CameraFrame *camera, f32 share)
 Move the chase camera behind a vehicle, blending the direction it was in towards the one behind the vehicle by a share.
void UpdateCameraLookAtTarget (Vehicle *vehicle)
 Put the look-at point above a vehicle, ahead of it by a lead that shrinks with its speed.
void ComputeCameraBasis (Vehicle *vehicle, CameraFrame *camera)
 Point a camera at the look-at point of a vehicle and build its axes about the world up.
void PlaceTrackCamera (Vehicle *vehicle)
 Make the trackside camera active, placed ahead of and beside a vehicle.
void UpdateCameraViewBasisAndFov (Vehicle *vehicle, CameraFrame *camera)
 Point a camera at a point one unit above a vehicle, build its axes about the world up, and zoom it with its distance from that point, as the trackside camera does.
void UpdateCameraSystem (Vehicle *vehicle)
 Update every camera of a vehicle for a frame.
void InitCameraForVehicle (Vehicle *vehicle)
 Set up the cameras of a vehicle at the start of a race.
void SetupCameraMatrix (CameraFrame *camera, f32 fov, f32 farDistance, f32 width, f32 height)
 Build the view and the perspective of a camera for a rectangle of the screen, and set the far distance.
void SetupFrustumCorners (CameraFrame *camera, f32 fov, f32 farDistance, f32 width, f32 height)
 Set up the corners of the far rectangle of the view of a camera, which the shadows clip to.

Variables

s32 g_bVehicleTrackCollisionCorrected
 Whether the last call of ResolveVehicleTrackCollision() moved the camera.
Vehicle * g_pActiveCameraVehicle
 The vehicle the view being drawn follows.
s32 g_dwReplayCameraHoldTimer
 Counts down the frames after the chase camera hits the track in a replay.
s32 g_dwReplayCameraSwitchTimer
 The frames until the replay changes its camera view again.
s32 g_dwCameraRayHitCount
 Set to 1 by the ray cast down from the active camera each frame.
u16 g_awCameraRayHitInstances []
 The placed models of the ground below the active camera, the nearest first.
s32 g_dwRearViewMirrorMode
 The size of the rear-view mirror over the bumper view: 0 for none, 1 small, 2 middling and 3 large.
f32 g_fCameraRayGroundDistance
 What CastRayAgainstTrack() found below the camera of the view being drawn.
s32 g_dwCameraRayGroundSurface
 The surface of the track below the active camera found by the last ray cast.
s32 g_dwCameraRayNearbyCount
 The nearby placed models found by the last camera ray cast.
u16 g_awCameraRayNearbyInstances []
 The indices of nearby placed models found by the last camera ray cast.
Vec3f g_afFrustumCenter
 The middle of the far rectangle of the view.
Vec3f g_vFrustumHalfRight
 Half the far rectangle of the view, across.
Vec3f g_vFrustumHalfUp
 Half the far rectangle of the view, up.

Detailed Description

The cameras that follow each vehicle.

Function Documentation

◆ ResolveVehicleTrackCollision()

void ResolveVehicleTrackCollision ( Vehicle * vehicle,
CameraFrame * camera,
Vec3f * target )

Keep a camera out of the track: if the line from the look-at point of a vehicle to the camera passes through a triangle, and so does the line from a target point, put the camera just in front of the triangle, no farther from the look-at point than it was.

Parameters
vehicleThe vehicle the camera follows.
cameraThe camera to move.
targetThe point the second line starts from.
Ghidra address:
USA: 0x80220810
Ghidra address:
Asia: 0x80220360
Ghidra address:
EUR: 0x80221b50
Ghidra address:
JPN: 0x80221340

◆ UpdateCameraChase()

void UpdateCameraChase ( Vehicle * vehicle,
CameraFrame * camera,
f32 share )

Move the chase camera behind a vehicle, blending the direction it was in towards the one behind the vehicle by a share.

Parameters
vehicleThe vehicle the camera follows.
cameraThe chase camera.
shareThe share of the way to the direction behind, from 0 for none to 1 for all of it.
Ghidra address:
USA: 0x80220c58
Ghidra address:
Asia: 0x802207A8
Ghidra address:
EUR: 0x80221f98
Ghidra address:
JPN: 0x80221788

◆ UpdateCameraLookAtTarget()

void UpdateCameraLookAtTarget ( Vehicle * vehicle)

Put the look-at point above a vehicle, ahead of it by a lead that shrinks with its speed.

Parameters
vehicleThe vehicle whose look-at point to move.
Ghidra address:
USA: 0x80220e84
Ghidra address:
Asia: 0x802209D4
Ghidra address:
EUR: 0x802221c4
Ghidra address:
JPN: 0x802219b4

◆ ComputeCameraBasis()

void ComputeCameraBasis ( Vehicle * vehicle,
CameraFrame * camera )

Point a camera at the look-at point of a vehicle and build its axes about the world up.

Parameters
vehicleThe vehicle whose look-at point to point at.
cameraThe camera whose axes to build.
Ghidra address:
USA: 0x80220ff4
Ghidra address:
Asia: 0x80220B44
Ghidra address:
EUR: 0x80222334
Ghidra address:
JPN: 0x80221b24

◆ PlaceTrackCamera()

void PlaceTrackCamera ( Vehicle * vehicle)

Make the trackside camera active, placed ahead of and beside a vehicle.

Parameters
vehicleThe vehicle the camera watches.
Ghidra address:
USA: 0x80221108
Ghidra address:
Asia: 0x80220C58
Ghidra address:
EUR: 0x80222448
Ghidra address:
JPN: 0x80221c38

◆ UpdateCameraViewBasisAndFov()

void UpdateCameraViewBasisAndFov ( Vehicle * vehicle,
CameraFrame * camera )

Point a camera at a point one unit above a vehicle, build its axes about the world up, and zoom it with its distance from that point, as the trackside camera does.

Parameters
vehicleThe vehicle the camera watches.
cameraThe camera whose axes and field of view to set.
Ghidra address:
EUR: 0x802224b0
Ghidra address:
JPN: 0x80221ca0

◆ UpdateCameraSystem()

void UpdateCameraSystem ( Vehicle * vehicle)

Update every camera of a vehicle for a frame.

Parameters
vehicleThe vehicle whose cameras to update.
Ghidra address:
USA: 0x80221170
Ghidra address:
Asia: 0x80220CC0
Ghidra address:
EUR: 0x80222600
Ghidra address:
JPN: 0x80221df0

◆ InitCameraForVehicle()

void InitCameraForVehicle ( Vehicle * vehicle)

Set up the cameras of a vehicle at the start of a race.

Parameters
vehicleThe vehicle whose cameras to set up.
Ghidra address:
USA: 0x80221864
Ghidra address:
Asia: 0x802213B4
Ghidra address:
EUR: 0x80222ba4
Ghidra address:
JPN: 0x80222394

◆ SetupCameraMatrix()

void SetupCameraMatrix ( CameraFrame * camera,
f32 fov,
f32 farDistance,
f32 width,
f32 height )

Build the view and the perspective of a camera for a rectangle of the screen, and set the far distance.

Parameters
cameraThe camera.
fovThe field of view, in radians, for a screen of 4 by 3.
farDistanceThe distance of the far plane.
widthThe width of the rectangle.
heightThe height of the rectangle.
Ghidra address:
USA: 0x8021b2f8
Ghidra address:
Asia: 0x8021AE48
Ghidra address:
EUR: 0x8021c434
Ghidra address:
JPN: 0x8021bd04
Ghidra address:
BRD3D: 0x10033e83
Ghidra address:
BRGlide: 0x1002d534

◆ SetupFrustumCorners()

void SetupFrustumCorners ( CameraFrame * camera,
f32 fov,
f32 farDistance,
f32 width,
f32 height )

Set up the corners of the far rectangle of the view of a camera, which the shadows clip to.

Parameters
cameraThe camera.
fovThe half angle of the view across, in radians.
farDistanceThe distance of the far plane.
widthThe width of the view.
heightThe height of the view.
Ghidra address:
USA: 0x8021b0c4
Ghidra address:
Asia: 0x8021AC14
Ghidra address:
EUR: 0x8021c200
Ghidra address:
JPN: 0x8021bad0
Ghidra address:
BRD3D: 0x10033cb1
Ghidra address:
BRGlide: 0x1002d362

Variable Documentation

◆ g_bVehicleTrackCollisionCorrected

s32 g_bVehicleTrackCollisionCorrected
extern

Whether the last call of ResolveVehicleTrackCollision() moved the camera.

Ghidra address:
USA: 0x8028b710
Ghidra address:
Asia: 0x8028B260
Ghidra address:
EUR: 0x8028d9c0
Ghidra address:
JPN: 0x8028d3f0
Ghidra address:
BRD3D: 0x100c129c
Ghidra address:
BRGlide: 0x100bcdcc

◆ g_pActiveCameraVehicle

Vehicle* g_pActiveCameraVehicle
extern

The vehicle the view being drawn follows.

Ghidra address:
USA: 0x8028aaf0
Ghidra address:
Asia: 0x8028A640
Ghidra address:
EUR: 0x8028ccf8
Ghidra address:
JPN: 0x8028c7c8
Ghidra address:
BRD3D: 0x106c2cf8
Ghidra address:
BRGlide: 0x106e9d88

◆ g_dwReplayCameraHoldTimer

s32 g_dwReplayCameraHoldTimer
extern

Counts down the frames after the chase camera hits the track in a replay.

Ghidra address:
USA: 0x8028b7fc
Ghidra address:
Asia: 0x8028B34C
Ghidra address:
EUR: 0x8028daac
Ghidra address:
JPN: 0x8028d4dc
Ghidra address:
BRD3D: 0x10af9bb4
Ghidra address:
BRGlide: 0x10b1cf14

◆ g_dwReplayCameraSwitchTimer

s32 g_dwReplayCameraSwitchTimer
extern

The frames until the replay changes its camera view again.

Ghidra address:
USA: 0x8028b7f8
Ghidra address:
Asia: 0x8028B348
Ghidra address:
EUR: 0x8028daa8
Ghidra address:
JPN: 0x8028d4d8
Ghidra address:
BRD3D: 0x10af9bb0
Ghidra address:
BRGlide: 0x10b1cf10

◆ g_dwCameraRayHitCount

s32 g_dwCameraRayHitCount
extern

Set to 1 by the ray cast down from the active camera each frame.

RenderPrecipitationEffect() checks that many of g_awCameraRayHitInstances.

Ghidra address:
USA: 0x8028ab00
Ghidra address:
Asia: 0x8028A650
Ghidra address:
EUR: 0x8028cd08
Ghidra address:
JPN: 0x8028c7d8
Ghidra address:
BRD3D: 0x106c1988
Ghidra address:
BRGlide: 0x106e8a18

◆ g_awCameraRayHitInstances

u16 g_awCameraRayHitInstances[]
extern

The placed models of the ground below the active camera, the nearest first.

Ghidra address:
USA: 0x8031b248
Ghidra address:
Asia: 0x8031ACF8
Ghidra address:
EUR: 0x8031d748
Ghidra address:
JPN: 0x8031c378
Ghidra address:
BRD3D: 0x106c6498
Ghidra address:
BRGlide: 0x106ed528

◆ g_dwRearViewMirrorMode

s32 g_dwRearViewMirrorMode
extern

The size of the rear-view mirror over the bumper view: 0 for none, 1 small, 2 middling and 3 large.

Ghidra address:
USA: 0x8028aa54
Ghidra address:
Asia: 0x8028A5A4
Ghidra address:
EUR: 0x8028cc5c
Ghidra address:
JPN: 0x8028c72c

◆ g_fCameraRayGroundDistance

f32 g_fCameraRayGroundDistance
extern

What CastRayAgainstTrack() found below the camera of the view being drawn.

Ghidra address:
USA: 0x8028aaf8
Ghidra address:
Asia: 0x8028A648
Ghidra address:
EUR: 0x8028cd00
Ghidra address:
JPN: 0x8028c7d0

◆ g_dwCameraRayGroundSurface

s32 g_dwCameraRayGroundSurface
extern

The surface of the track below the active camera found by the last ray cast.

Ghidra address:
USA: 0x8028aafc
Ghidra address:
Asia: 0x8028A64C
Ghidra address:
EUR: 0x8028cd04
Ghidra address:
JPN: 0x8028c7d4

◆ g_dwCameraRayNearbyCount

s32 g_dwCameraRayNearbyCount
extern

The nearby placed models found by the last camera ray cast.

Ghidra address:
USA: 0x8028ab04
Ghidra address:
Asia: 0x8028A654
Ghidra address:
EUR: 0x8028cd0c
Ghidra address:
JPN: 0x8028c7dc

◆ g_awCameraRayNearbyInstances

u16 g_awCameraRayNearbyInstances[]
extern

The indices of nearby placed models found by the last camera ray cast.

Ghidra address:
USA: 0x8031b288
Ghidra address:
Asia: 0x8031AD38
Ghidra address:
EUR: 0x8031d788
Ghidra address:
JPN: 0x8031c3b8

◆ g_afFrustumCenter

Vec3f g_afFrustumCenter
extern

The middle of the far rectangle of the view.

Ghidra address:
USA: 0x8031abf0
Ghidra address:
Asia: 0x8031A6A0
Ghidra address:
EUR: 0x8031d0f0
Ghidra address:
JPN: 0x8031bd20
Ghidra address:
BRD3D: 0x106c2990
Ghidra address:
BRGlide: 0x106e9a20

◆ g_vFrustumHalfRight

Vec3f g_vFrustumHalfRight
extern

Half the far rectangle of the view, across.

Ghidra address:
USA: 0x8031abd0
Ghidra address:
Asia: 0x8031A680
Ghidra address:
EUR: 0x8031d0d0
Ghidra address:
JPN: 0x8031bd00
Ghidra address:
BRD3D: 0x106c56f8
Ghidra address:
BRGlide: 0x106ec788

◆ g_vFrustumHalfUp

Vec3f g_vFrustumHalfUp
extern

Half the far rectangle of the view, up.

Ghidra address:
USA: 0x8031abe0
Ghidra address:
Asia: 0x8031A690
Ghidra address:
EUR: 0x8031d0e0
Ghidra address:
JPN: 0x8031bd10
Ghidra address:
BRD3D: 0x106c0690
Ghidra address:
BRGlide: 0x106e7720