wavelength 1.0.0
Loading...
Searching...
No Matches
spotlightfx.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <memory>
5
6#include "gfx/gfxtunnel.h"
7#include "gfx/tnlgeom.h"
8#include "gfx/tnltrackrange.h"
9#include "math/transform.h"
10#include "math/vector3.h"
11#include "rnd/rndmesh.h"
12#include "rnd/rndmultimesh.h"
13#include "script/dataarray.h"
14
23public:
25 class LightPos {
26 public:
36 static bool Before(const LightPos &pos, float flTick) {
37 return pos.mTick < flTick;
38 }
39
40 float mTick;
41 char mTrack;
42 float mLateral;
43 Transform mReserved10; // +0x10 Copied in, never read.
45 std::list<Transform>::iterator mSpot;
46 std::list<Transform>::iterator mGlow;
47 };
48
56
64
76 static void
77 LoadConfig(DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption);
78
85 void Poll();
86
93 void Draw();
94
105 void AddLight(char nTrack, TnlGeom *pGeom, float flTick, float flLateral);
106
115 void RemoveLight(char nTrack, float flTick);
116
126 void RemoveLights(char nTrack, float flStartTick, float flEndTick);
127
134 void Clear();
135
144 void UpdateRange(TnlGeom *pGeom, const TnlTrackRange *pRange);
145
146private:
147 std::list<Transform> mTransforms;
148 RndMesh *mMesh;
149 std::unique_ptr<RndMultiMesh> mSpots;
150 std::unique_ptr<RndMultiMesh> mGlows;
151 std::list<LightPos> mLights;
152
160 void Release(std::list<LightPos>::iterator light);
161
171 void DetachSpot(std::list<LightPos>::iterator light);
172
181 static void Place(LightPos *pLight, TnlGeom *pGeom);
182};
Reference-counted array of script data nodes.
Definition dataarray.h:20
Tunnel of tracks the players fly down, with the gems, the cameras of the players, and the effects dra...
Definition gfxtunnel.h:58
Triangle mesh with a material.
Definition rndmesh.h:31
One spotlight, 0x60 bytes.
Definition spotlightfx.h:25
std::list< Transform >::iterator mSpot
Definition spotlightfx.h:45
char mTrack
Definition spotlightfx.h:41
int mSpotActive
Definition spotlightfx.h:44
static bool Before(const LightPos &pos, float flTick)
Report whether a light comes before a tick, the order of the list.
Definition spotlightfx.h:36
std::list< Transform >::iterator mGlow
Definition spotlightfx.h:46
float mLateral
Definition spotlightfx.h:42
Transform mReserved10
Definition spotlightfx.h:43
float mTick
Definition spotlightfx.h:40
void AddLight(char nTrack, TnlGeom *pGeom, float flTick, float flLateral)
Light a gem, unless a light of the same tick and track exists.
void UpdateRange(TnlGeom *pGeom, const TnlTrackRange *pRange)
Place again the lights in a range of the tunnel that changed.
void Poll()
Advance the spotlights.
void Clear()
Remove every light.
void RemoveLights(char nTrack, float flStartTick, float flEndTick)
Remove the lights of a track over a span of ticks.
SpotLightFX()
Find the meshes and create the multimeshes, and fill the pool of transforms.
~SpotLightFX()
Release the multimeshes.
static void LoadConfig(DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption)
Load the fade ticks and the scales of the spotlights.
void Draw()
Drop the spotlights behind the song, and draw the glows and the spotlights.
void RemoveLight(char nTrack, float flTick)
Remove the lights of a track over one tick.
The geometry of the tracks of the tunnel, which places a cell of a track in the world.
Definition tnlgeom.h:32
A run of tracks over a span of ticks, which the tunnel reports when the region changes.
Definition tnltrackrange.h:8
Affine transform stored as three basis rows and a translation row.
Definition transform.h:18