|
wavelength 1.0.0
|
The geometry of the tracks of the tunnel, which places a cell of a track in the world. More...
#include <tnlgeom.h>
Classes | |
| struct | CrossSectionXfm |
| One cross section of a panel, 0x70 bytes. More... | |
| struct | TrackGeometry |
| The flat cross section of one track, 0xa0 bytes. More... | |
| class | MeshHolder |
| Owner of a mesh the panels are built from, 4 bytes. More... | |
| class | PanelData |
| One built bar of one track, 0xd0 bytes. More... | |
| class | TrackData |
| The state of one track, 0x30 bytes. More... | |
| class | Player |
| The place of a player in the tunnel, 0x38 bytes. More... | |
Public Member Functions | |
| TnlGeom () | |
| Construct an empty geometry. | |
| ~TnlGeom () | |
| Destroy the geometry. | |
| void * | operator new (size_t nSize) |
| Allocate a geometry from the pool, billed to Tunnel. | |
| void | operator delete (void *pBlock) |
| Release a geometry. | |
| void | LoadConfig (DataArray *pConfig, DataArray *pDefaults, int nOption) |
| Load the settings of the geometry. | |
| bool | Init (const std::vector< std::pair< Vector2, Vector2 > > *pEdges, int nNumBars, int nDetail, int nBarsBehind, float flSlabDepth, float flSlabAngle, RndTransAnim *pPath, const std::vector< Color > *pColors, RndMat *pPanelMat, RndMatAnim *pPanelAnim) |
| Set up the tracks from the edges of the cross section, and the passes of the standard panel from a material and an animation of it, then rebuild the meshes and the ring of panels. | |
| void | Poll (float flTick, float flDeltaTicks) |
| Advance the geometry to a tick, building the bars ahead and moving the players and their activators. | |
| void | DrawPanels () |
| Rebuild the dirty panels, then draw the built bars from mBarsBehind before the end of the ring back to the first bar of the song, as the tunnel does in a solo game or outside the Game rule set. | |
| void | DrawPanelsMultiplayer () |
| Draw as DrawPanels() does, as the tunnel does in a game of several players with the Game rule set. | |
| void | DrawOverlays () |
| Draw the bars of the ring before the song with the bar values, the overlays of the tracks, and the materials of the bars, as the last step of DrawPanels() does, but with each mesh writing depth while it draws. | |
| void | BuildBars () |
| Build the bars of the ring that are not built yet. | |
| void | BuildBar (int nBar) |
| Build the cross sections of one bar on every track along the path, and give the slot of the bar its material. | |
| void | ResetPanels () |
| Put every panel back in its first state, white and transparent, and mark every slot of the ring as not built. | |
| void | ResetPlayers () |
| Put every player at its track at once. | |
| void | SetNumPlayers (int nPlayers) |
| Set the number of players, attaching each to the geometry with its index. | |
| void | SetMoveLength (float flLength) |
| Set the ticks of a move of a player to the next track. | |
| Player * | GetPlayer (int nPlayer) |
| Report the place of a player. | |
| float | MoveLength (float flFrom, float flTo) const |
| Report the length of a move between two tracks. | |
| void | TrackXfm (int nTrack, Transform *pXfm, bool bSmoothBasis, float flTick, float flLateral) |
| Work out the transform of a cell of a track without the offset of the track. | |
| void | BlendTrack (Transform *pXfm, bool bSmoothBasis, float flTrack, float flTick, float flLateral) |
| Work out the transform of a cell at a fractional track, blending the transforms of the two nearest tracks. | |
| float | BuiltEndTick () const |
| Report the tick a little before the end of the built bars. | |
| void | CellXfm (int nTrack, Transform *pXfm, bool bSmoothBasis, bool bTrackOffset, float flTick, float flLateral) |
| Work out the transform of a cell of a track. | |
| void | PlaceCell (int nTrack, Transform *pXfm, bool bSmoothBasis, bool bTrackOffset, float flTick, float flLateral, float flRaise) |
| Work out the transform of a cell, sunk below the surface of the track. | |
| void | BlendCell (Transform *pXfm, bool bSmoothBasis, bool bTrackOffset, float flTrack, float flTick, float flLateral) |
| Work out the transform of a cell at a fractional track, blending the two nearest tracks. | |
| void | PathXfm (Transform *pXfm, float flTick) |
| Work out the transform of the path of the tunnel at a tick. | |
| std::vector< CrossSectionXfm > * | GetSections (int nTrack, int nBar, bool bDirty) |
| Report the sections of a built panel. | |
| PanelData * | GetPanel (int nTrack, int nBar) |
| Report a built panel. | |
| void | RestoreSections (int nTrack, int nBar) |
| Put the sections of a built panel back as the bar was built. | |
| void | SetTrackOffset (int nTrack, const Vector3 *pOffset) |
| Set the offset of a track, which CellXfm() adds in the basis of the cell. | |
| void | SetTrackColor (int nTrack, const Color *pColor) |
| Set the colour of the panels of a track. | |
| Color * | GetTrackColor (int nTrack) |
| Report the colour of the panels of a track. | |
| void | SetBarValue (int nBar, RndMat *pMat) |
| Set the checkpoint material of a built bar in mBarValues. | |
| void | SetPanelState (int nTrack, int nBar, char bTransparent, RndMat *pCheckpointMat, int bPickable, bool bHighlighted, const Color *pColor) |
| Set the state of a built panel. | |
| void | SetPanelColor (int nTrack, int nBar, const Color *pColor, bool bHighlighted) |
| Set the colour of a built panel. | |
| void | SetAllPanelColors (const Color *pColor, bool bHighlighted) |
| Set the colour of every built panel. | |
| Color * | GetPanelColor (int nTrack, int nBar) |
| Report the colour of a built panel. | |
| void | SetPanelStartSection (int nTrack, int nBar, char nSection) |
| Set the first section of a built panel the mesh moves along. | |
| void | SetTrackOverlay (int nTrack, RndMat *pMat, int nMode) |
| Set the material drawn over a track. | |
| void | SetPanelMat (RndMat *pMat, int nKind) |
| Set the material of a kind of panel, or the default material. | |
| void | BlendPath (RndTransAnim *pAnim, int bLoop, int bUseTime, float flLength, float flStart, float flFrame, float flLoopStart, float flLoopEnd) |
| Blend the path to a new animation. | |
| void | SetPath (RndTransAnim *pAnim) |
| Replace the path at once with an animation that starts at frame 0. | |
| bool | Pick (const Segment *pSegment, int *pnTrack, int *pnBar) |
| Find the built panel a segment strikes first. | |
| int | GetNumBars () const |
| int | GetBarsBehind () const |
| int | GetShowPanels () const |
| void | SetShowPanels (int bShow) |
| Set whether the panels show. | |
| float | GetBarsPerTick () const |
| int | GetSectionsPerBar () const |
| int | GetFirstBar () const |
| int | GetMinFirstBar () const |
| void | SetMinFirstBar (int nBar) |
| Set the least bar Poll() starts the ring at. | |
| int | GetEndBar () const |
| void | SetEndBar (int nBar) |
| Set the first bar that is never built. | |
| int | GetNumTracks () const |
| const TrackGeometry & | GetTrackGeometry (int nTrack) const |
| Report the flat cross section of a track. | |
Static Public Attributes | |
| static constexpr int | kRingMask = 7 |
| Bars of the ring of built panels a bar index selects with its low bits. | |
| static constexpr int | kNoBar = 100000000 |
| The bar a slot of the ring holds when no bar is built in it. | |
The geometry of the tracks of the tunnel, which places a cell of a track in the world.
The class is not polymorphic, and the name comes from the RTTI of its nested types. The object is 0x160 bytes. The tunnel is built one bar at a time into a ring of mNumBars panels on each track. A panel is a strip of cross sections placed along the path and drawn through a mesh. A tick with no built panel falls back to the flat cross section of its track carried along the path.
| TnlGeom::TnlGeom | ( | ) |
Construct an empty geometry.
| TnlGeom::~TnlGeom | ( | ) |
Destroy the geometry.
|
inline |
Allocate a geometry from the pool, billed to Tunnel.
| nSize | The object size the compiler supplies. |
|
inline |
Release a geometry.
| pBlock | The block. |
Load the settings of the geometry.
The body is empty.
| pConfig | The configuration. |
| pDefaults | The defaults of the configuration. |
| nOption | The fourth argument every loader of the tunnel graphics receives. |
| bool TnlGeom::Init | ( | const std::vector< std::pair< Vector2, Vector2 > > * | pEdges, |
| int | nNumBars, | ||
| int | nDetail, | ||
| int | nBarsBehind, | ||
| float | flSlabDepth, | ||
| float | flSlabAngle, | ||
| RndTransAnim * | pPath, | ||
| const std::vector< Color > * | pColors, | ||
| RndMat * | pPanelMat, | ||
| RndMatAnim * | pPanelAnim ) |
Set up the tracks from the edges of the cross section, and the passes of the standard panel from a material and an animation of it, then rebuild the meshes and the ring of panels.
Each texture stage of pPanelMat becomes one material tnl std panel mat pass <n>, and each stage of pPanelAnim with transform keys one animation tnl std matanim stage <n> of the material of its pass. A track past the end of pColors takes the last colour.
| pEdges | The left and the right edge of each track, X then Z. |
| nNumBars | The bars of each track in the ring of built panels. |
| nDetail | One more than the doublings of the cross sections of a bar. |
| nBarsBehind | The built bars retained behind the current bar. |
| flSlabDepth | The depth of a slab under the panels. |
| flSlabAngle | The angle of the sides of a slab, in radians. |
| pPath | The animation of the path. |
| pColors | The colour of each track. |
| pPanelMat | The material of the standard panel. |
| pPanelAnim | The animation of pPanelMat. |
| void TnlGeom::Poll | ( | float | flTick, |
| float | flDeltaTicks ) |
Advance the geometry to a tick, building the bars ahead and moving the players and their activators.
| flTick | The tick of the song. |
| flDeltaTicks | The ticks since the last poll. |
| void TnlGeom::DrawPanels | ( | ) |
Rebuild the dirty panels, then draw the built bars from mBarsBehind before the end of the ring back to the first bar of the song, as the tunnel does in a solo game or outside the Game rule set.
Tracks with an overlay mode skip the first three passes. The checkpoint material of each panel draws first. Then each pass of the standard panel draws the opaque panels without a checkpoint, the first pass in the colour of each panel. Last, each track with a player, an overlay, or changed bar values draws its opaque panels with the bar value or the overlay, and a track with a player draws its transparent panels with the material of their bar. The call then sets mAnimateMoves. The title is inferred.
| void TnlGeom::DrawPanelsMultiplayer | ( | ) |
Draw as DrawPanels() does, as the tunnel does in a game of several players with the Game rule set.
The first pass of the standard panel draws without the colour of each panel, and each later pass takes the colour of the panel and the light colour in mPassLightColors for whether the panel is highlighted. The title is inferred.
| void TnlGeom::DrawOverlays | ( | ) |
Draw the bars of the ring before the song with the bar values, the overlays of the tracks, and the materials of the bars, as the last step of DrawPanels() does, but with each mesh writing depth while it draws.
The title is inferred.
| void TnlGeom::BuildBars | ( | ) |
Build the bars of the ring that are not built yet.
Bars at or after mEndBar are marked as not built. While mAnimateMoves is set, the call stops after the first bar it builds.
| void TnlGeom::BuildBar | ( | int | nBar | ) |
Build the cross sections of one bar on every track along the path, and give the slot of the bar its material.
A bar before the song takes the kind of panel counted back from the last kind, and every other bar takes the default material. The last section of each panel starts the panel as transparent, not pickable, unhighlighted, and in the colour of its track.
| nBar | The bar. |
| void TnlGeom::ResetPanels | ( | ) |
Put every panel back in its first state, white and transparent, and mark every slot of the ring as not built.
| void TnlGeom::ResetPlayers | ( | ) |
Put every player at its track at once.
| void TnlGeom::SetNumPlayers | ( | int | nPlayers | ) |
Set the number of players, attaching each to the geometry with its index.
| nPlayers | The number of players. |
| void TnlGeom::SetMoveLength | ( | float | flLength | ) |
Set the ticks of a move of a player to the next track.
| flLength | The ticks. |
| Player * TnlGeom::GetPlayer | ( | int | nPlayer | ) |
Report the place of a player.
| nPlayer | The player. |
| float TnlGeom::MoveLength | ( | float | flFrom, |
| float | flTo ) const |
Report the length of a move between two tracks.
| flFrom | The track the move starts at. |
| flTo | The track the move ends at. |
| void TnlGeom::TrackXfm | ( | int | nTrack, |
| Transform * | pXfm, | ||
| bool | bSmoothBasis, | ||
| float | flTick, | ||
| float | flLateral ) |
Work out the transform of a cell of a track without the offset of the track.
| nTrack | The track. |
| pXfm | Receives the transform. |
| bSmoothBasis | Blend the basis between the two nearest cross sections. |
| flTick | The tick along the track. |
| flLateral | The position across the track, from 0 to 1. |
| void TnlGeom::BlendTrack | ( | Transform * | pXfm, |
| bool | bSmoothBasis, | ||
| float | flTrack, | ||
| float | flTick, | ||
| float | flLateral ) |
Work out the transform of a cell at a fractional track, blending the transforms of the two nearest tracks.
| pXfm | Receives the transform. |
| bSmoothBasis | Blend the basis between the two nearest cross sections. |
| flTrack | The track, which may lie between two tracks and wraps around the tunnel. |
| flTick | The tick along the track. |
| flLateral | The position across the track, from 0 to 1. |
| float TnlGeom::BuiltEndTick | ( | ) | const |
Report the tick a little before the end of the built bars.
| void TnlGeom::CellXfm | ( | int | nTrack, |
| Transform * | pXfm, | ||
| bool | bSmoothBasis, | ||
| bool | bTrackOffset, | ||
| float | flTick, | ||
| float | flLateral ) |
Work out the transform of a cell of a track.
The X axis runs across the track and the Z axis away from its surface.
| nTrack | The track. |
| pXfm | Receives the transform. |
| bSmoothBasis | Blend the basis between the two nearest cross sections. |
| bTrackOffset | Add the offset of the track to the position. |
| flTick | The tick along the track. |
| flLateral | The position across the track, from 0 to 1. |
| void TnlGeom::PlaceCell | ( | int | nTrack, |
| Transform * | pXfm, | ||
| bool | bSmoothBasis, | ||
| bool | bTrackOffset, | ||
| float | flTick, | ||
| float | flLateral, | ||
| float | flRaise ) |
Work out the transform of a cell, sunk below the surface of the track.
The position moves along the Z axis by one less flRaise.
| nTrack | The track. |
| pXfm | Receives the transform. |
| bSmoothBasis | Blend the basis between the two nearest cross sections. |
| bTrackOffset | Add the offset of the track to the position. |
| flTick | The tick along the track. |
| flLateral | The position across the track, from 0 to 1. |
| flRaise | The height above the track, where 1 is the surface. |
| void TnlGeom::BlendCell | ( | Transform * | pXfm, |
| bool | bSmoothBasis, | ||
| bool | bTrackOffset, | ||
| float | flTrack, | ||
| float | flTick, | ||
| float | flLateral ) |
Work out the transform of a cell at a fractional track, blending the two nearest tracks.
| pXfm | Receives the transform. |
| bSmoothBasis | Blend the basis between the two nearest cross sections. |
| bTrackOffset | Add the offset of the track to the position. |
| flTrack | The track, which may lie between two tracks and wraps around the tunnel. |
| flTick | The tick along the track. |
| flLateral | The position across the track, from 0 to 1. |
| void TnlGeom::PathXfm | ( | Transform * | pXfm, |
| float | flTick ) |
Work out the transform of the path of the tunnel at a tick.
A tunnel without a path animation gives the identity.
| pXfm | Receives the transform. |
| flTick | The tick. |
| std::vector< CrossSectionXfm > * TnlGeom::GetSections | ( | int | nTrack, |
| int | nBar, | ||
| bool | bDirty ) |
Report the sections of a built panel.
| nTrack | The track. |
| nBar | The bar. |
| bDirty | Mark the panel to be rebuilt. |
| PanelData * TnlGeom::GetPanel | ( | int | nTrack, |
| int | nBar ) |
Report a built panel.
| nTrack | The track. |
| nBar | The bar. |
| void TnlGeom::RestoreSections | ( | int | nTrack, |
| int | nBar ) |
Put the sections of a built panel back as the bar was built.
| nTrack | The track. |
| nBar | The bar. |
| void TnlGeom::SetTrackOffset | ( | int | nTrack, |
| const Vector3 * | pOffset ) |
Set the offset of a track, which CellXfm() adds in the basis of the cell.
| nTrack | The track. |
| pOffset | The offset. |
| void TnlGeom::SetTrackColor | ( | int | nTrack, |
| const Color * | pColor ) |
Set the colour of the panels of a track.
| nTrack | The track. |
| pColor | The colour. |
| Color * TnlGeom::GetTrackColor | ( | int | nTrack | ) |
Report the colour of the panels of a track.
| nTrack | The track. |
| void TnlGeom::SetBarValue | ( | int | nBar, |
| RndMat * | pMat ) |
Set the checkpoint material of a built bar in mBarValues.
| nBar | The bar. |
| pMat | The checkpoint material, or null. |
| void TnlGeom::SetPanelState | ( | int | nTrack, |
| int | nBar, | ||
| char | bTransparent, | ||
| RndMat * | pCheckpointMat, | ||
| int | bPickable, | ||
| bool | bHighlighted, | ||
| const Color * | pColor ) |
Set the state of a built panel.
| nTrack | The track. |
| nBar | The bar. |
| bTransparent | Whether the panel does not write depth. |
| pCheckpointMat | The checkpoint material of the panel, or null. |
| bPickable | Whether picks test the panel. |
| bHighlighted | Whether the panel is drawn highlighted. |
| pColor | The colour, or null to retain the colour. |
| void TnlGeom::SetPanelColor | ( | int | nTrack, |
| int | nBar, | ||
| const Color * | pColor, | ||
| bool | bHighlighted ) |
Set the colour of a built panel.
| nTrack | The track. |
| nBar | The bar. |
| pColor | The colour, or null to retain the colour. |
| bHighlighted | Whether the panel is drawn highlighted. |
| void TnlGeom::SetAllPanelColors | ( | const Color * | pColor, |
| bool | bHighlighted ) |
Set the colour of every built panel.
| pColor | The colour, or null for the colour of the track of each panel. |
| bHighlighted | Whether the panels are drawn highlighted. |
| Color * TnlGeom::GetPanelColor | ( | int | nTrack, |
| int | nBar ) |
Report the colour of a built panel.
| nTrack | The track. |
| nBar | The bar. |
| void TnlGeom::SetPanelStartSection | ( | int | nTrack, |
| int | nBar, | ||
| char | nSection ) |
Set the first section of a built panel the mesh moves along.
| nTrack | The track. |
| nBar | The bar. |
| nSection | The section. |
| void TnlGeom::SetTrackOverlay | ( | int | nTrack, |
| RndMat * | pMat, | ||
| int | nMode ) |
Set the material drawn over a track.
| nTrack | The track. |
| pMat | The material, or null. |
| nMode | How the overlay is drawn. |
| void TnlGeom::SetPanelMat | ( | RndMat * | pMat, |
| int | nKind ) |
Set the material of a kind of panel, or the default material.
| pMat | The material. |
| nKind | The kind, or an index below kDefaultMatThreshold for the default material. |
| void TnlGeom::BlendPath | ( | RndTransAnim * | pAnim, |
| int | bLoop, | ||
| int | bUseTime, | ||
| float | flLength, | ||
| float | flStart, | ||
| float | flFrame, | ||
| float | flLoopStart, | ||
| float | flLoopEnd ) |
Blend the path to a new animation.
| pAnim | The new animation. |
| bLoop | Whether the new animation loops. |
| bUseTime | Whether the frame of the new animation follows the time. |
| flLength | The length of the blend in ticks. |
| flStart | The tick the blend starts at. |
| flFrame | The frame of the new animation at flStart. |
| flLoopStart | The first frame of the loop of the new animation. |
| flLoopEnd | The frame the loop of the new animation wraps at. |
| void TnlGeom::SetPath | ( | RndTransAnim * | pAnim | ) |
Replace the path at once with an animation that starts at frame 0.
| pAnim | The animation, or null for no path. |
| bool TnlGeom::Pick | ( | const Segment * | pSegment, |
| int * | pnTrack, | ||
| int * | pnBar ) |
Find the built panel a segment strikes first.
| pSegment | The segment. |
| pnTrack | Receives the track of the panel. |
| pnBar | Receives the bar of the panel. |
|
inline |
|
inline |
|
inline |
|
inline |
Set whether the panels show.
| bShow | Whether they show. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set the least bar Poll() starts the ring at.
| nBar | The bar. |
|
inline |
|
inline |
Set the first bar that is never built.
| nBar | The bar. |
|
inline |
|
inline |
Report the flat cross section of a track.
| nTrack | The track. |
|
staticconstexpr |
Bars of the ring of built panels a bar index selects with its low bits.
|
staticconstexpr |
The bar a slot of the ring holds when no bar is built in it.