|
coastline 0.0.4
|
The drawing of the placed models of the track near the camera, and of the shadows of the vehicles on them. More...
#include <PR/gbi.h>#include <PR/ultratypes.h>#include "common/shadowbuffers.h"#include "common/vecmath.h"#include "common/vehicle.h"
Go to the source code of this file.
Classes | |
| struct | VisibleCell |
| A cell of the grid of the track in view, and its squared distance from the camera in cells. More... | |
Macros | |
| #define | VISIBLE_CELLS 192 |
| The most cells in view, past which the farthest are left out. | |
Functions | |
| 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 view being drawn, which are left as they were when the point is at the camera. | |
| 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 texture of the shadow and its triangles outside the texture omitted. | |
| s32 | CompareVisibleCellDistance (const void *a, const void *b) |
| Order two cells in view by their distance from the camera. | |
| void | BuildVisibleInstanceList (void) |
| List the placed models of the cells in view, the nearest cells first, mark the models the nearest vehicles cast shadows on, set the lights and the reflections of the track, and find the rectangle of the screen of the shadow of each vehicle. | |
| void | RenderTrackGeometry (s32 deferred) |
| Draw the placed models in view: in the first pass the opaque ones, leaving the translucent ones, and in the second pass those, the farthest first. | |
Variables | |
| PlayerProfile * | g_pActiveProfile |
| The profile used for the active season when selecting track instances. | |
| s32 | g_bShadowCullDisabled |
| Whether shadows include triangles outside their texture and extend beyond their vehicle's screen rectangle. | |
| VisibleCell | g_aVisibleCellTuples [VISIBLE_CELLS+1] |
| The cells in view, the nearest first, ending with a column of 0xFF. | |
| s32 | g_bVisibleCellListOverflow |
| Whether the cells in view were more than VISIBLE_CELLS. | |
| s32 | g_nVisibleInstanceCount |
| The placed models in view this frame. | |
| u8 | g_abInstanceVisibilityMask [] |
| For each placed model: 0xFF until it is listed in view, then 0 with a bit for each vehicle near enough to cast its shadow on it. | |
| s32 | g_nVisibleCellIdxNear |
| Where in the list of the models the cells start that are at least 3 cells from the camera, more than 1 or, in a replay from the trackside camera, 3, and within 3 cells of the far plane, or -1. | |
| s32 | g_nVisibleCellIdxMid |
| Where the middle-distance model group starts, or -1. | |
| s32 | g_nVisibleCellIdxFar |
| Where the models of cells within three cells of the far plane start, or -1. | |
| s32 | g_nTrackTransparentStartIdx |
| Where the translucent models past g_nVisibleCellIdxMid start in the second pass, which draws them without shadows, and 0x1000 until it is known. | |
| s32 | g_nDeferredInstanceLastIdx |
| The last translucent model left for the second pass, or -1. | |
| 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_bDebugHideInstance |
| Whether g_nDebugHiddenInstanceIndex is left undrawn. | |
| u32 | g_dwTrackOtherModeLBlend |
| The blender and the other bits of the render mode of the track. | |
| u32 | g_dwTrackOtherModeLFlags |
| The render-mode flags applied with g_dwTrackOtherModeLBlend. | |
| s32 | g_nNearbyVehicleCount |
| The vehicles nearest the camera that cast shadows, nearest first. | |
| s32 | g_anNearbyVehicleIdx [MAX_VEHICLES] |
| The indices of the vehicles near enough to cast shadows on placed models. | |
| f32 | g_afNearbyVehicleDot [MAX_VEHICLES] |
| How far ahead of the camera each one is. | |
| Vec3f | g_vVehicleVisibilityDelta |
| From the camera to a vehicle. | |
| f32 | g_fViewMatrixMaxAbs |
| The largest absolute value of the first three rows of g_afViewProjMatrix. | |
| LookAt * | g_pTrackLookAt |
| The look-at of the reflections of the track. | |
| Lights1 | g_aTrackLights [4] |
| The lights of the track, one of four in turn each frame. | |
| s32 | g_nTrackLightBufferIndex |
| The index of the light buffer used to draw the track this frame. | |
| Vec3f | g_vTrackLightDirection |
| The direction of the light of the track. | |
| Vec3f | g_vShadowForward |
| The forward of the vehicle whose shadow is being cast, on the ground. | |
| const f32 | g_fShadowLengthScale |
| Scale of the vehicle shadow along its length. | |
| const f32 | g_fShadowWidthScale |
| Scale of the vehicle shadow across its width. | |
The drawing of the placed models of the track near the camera, and of the shadows of the vehicles on them.
| #define VISIBLE_CELLS 192 |
The most cells in view, past which the farthest are left out.
Take a point and a size around it to the corners of the rectangle of the screen they cover in the view being drawn, which are left as they were when the point is at the camera.
| point | The point. |
| size | The size around it. |
| low | The left and the lower edge. |
| high | The right and the upper edge. |
Draw a placed model, and on it the shadow of each vehicle in a mask, by its vertices taken to the texture of the shadow and its triangles outside the texture omitted.
| index | The placed model. |
| vehicles | A bit for each vehicle whose shadow falls on it. |
| deferred | Whether to draw shadows as translucent in the second pass. |
| s32 CompareVisibleCellDistance | ( | const void * | a, |
| const void * | b ) |
Order two cells in view by their distance from the camera.
| a | The first cell. |
| b | The second cell. |
| void BuildVisibleInstanceList | ( | void | ) |
List the placed models of the cells in view, the nearest cells first, mark the models the nearest vehicles cast shadows on, set the lights and the reflections of the track, and find the rectangle of the screen of the shadow of each vehicle.
| void RenderTrackGeometry | ( | s32 | deferred | ) |
Draw the placed models in view: in the first pass the opaque ones, leaving the translucent ones, and in the second pass those, the farthest first.
| deferred | Whether this is the second pass. |
|
extern |
The profile used for the active season when selecting track instances.
|
extern |
Whether shadows include triangles outside their texture and extend beyond their vehicle's screen rectangle.
|
extern |
The cells in view, the nearest first, ending with a column of 0xFF.
|
extern |
Whether the cells in view were more than VISIBLE_CELLS.
|
extern |
The placed models in view this frame.
|
extern |
For each placed model: 0xFF until it is listed in view, then 0 with a bit for each vehicle near enough to cast its shadow on it.
|
extern |
Where in the list of the models the cells start that are at least 3 cells from the camera, more than 1 or, in a replay from the trackside camera, 3, and within 3 cells of the far plane, or -1.
|
extern |
Where the middle-distance model group starts, or -1.
|
extern |
Where the models of cells within three cells of the far plane start, or -1.
|
extern |
Where the translucent models past g_nVisibleCellIdxMid start in the second pass, which draws them without shadows, and 0x1000 until it is known.
|
extern |
The last translucent model left for the second pass, or -1.
|
extern |
The TRACK_INSTANCE_ flags of the placed models not drawn.
|
extern |
The groups of placed models hidden from the camera.
|
extern |
Whether g_nDebugHiddenInstanceIndex is left undrawn.
|
extern |
The blender and the other bits of the render mode of the track.
|
extern |
The render-mode flags applied with g_dwTrackOtherModeLBlend.
|
extern |
The vehicles nearest the camera that cast shadows, nearest first.
|
extern |
The indices of the vehicles near enough to cast shadows on placed models.
|
extern |
How far ahead of the camera each one is.
|
extern |
From the camera to a vehicle.
|
extern |
The largest absolute value of the first three rows of g_afViewProjMatrix.
|
extern |
The look-at of the reflections of the track.
|
extern |
The lights of the track, one of four in turn each frame.
|
extern |
The index of the light buffer used to draw the track this frame.
|
extern |
The direction of the light of the track.
|
extern |
The forward of the vehicle whose shadow is being cast, on the ground.
|
extern |
Scale of the vehicle shadow along its length.
|
extern |
Scale of the vehicle shadow across its width.