wavelength 1.0.0
Loading...
Searching...
No Matches
tnlgems.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <map>
5#include <memory>
6#include <vector>
7
8#include "gfx/gfxtunnel.h"
9#include "gfx/meshgroup.h"
10#include "gfx/spritegroup.h"
11#include "gfx/tnlgem.h"
12#include "gfx/tnltrackrange.h"
13#include "math/transform.h"
14#include "rnd/rndanimatable.h"
15#include "rnd/rndmesh.h"
16#include "rnd/rndobject.h"
17#include "script/dataarray.h"
18
25class TnlGems {
26public:
36 TnlGems(GfxTunnel *pTunnel, int nMaxGems, int nNumTracks);
37
45
57 static void
58 LoadConfig(DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption);
59
70 char AddMeshGroups(const char *pszName, const char *pszDrawParent, float flLookahead);
71
85 char AddCompositeMeshGroups(const char *pszName, const char *pszDrawParent, float flLookahead);
86
95 char AddSpriteGroup(const char *pszName);
96
113 void AddRotations(char nType,
114 int nKeys,
115 int bLoop,
116 RndAnimatable *pParent,
117 float flStartFrame,
118 float flStartAngle,
119 float flEndFrame,
120 float flEndAngle);
121
129 void ClearInstances(const char *pszName);
130
137 static void ApplyRenderScales();
138
148
158
172 void AddGem(char nTrack,
173 char nType,
174 char nSlot,
175 int bFlash,
176 char nColor,
177 float flTick,
178 float flShowTick);
179
189 void RemoveGems(char nTrack, float flStartTick, float flEndTick);
190
200 void RemoveGem(char nTrack, char nSlot, float flTick);
201
208 void Clear();
209
218 void Poll(const TnlTrackRange *pRange);
219
229
238 std::list<TnlGem>::iterator LowerBound(float flTick);
239
248 std::list<TnlGem>::iterator Find(float flTick);
249
251 std::list<TnlGem> &GetGemList() {
252 return mGems;
253 }
254
260 void SetFocusTrack(char nTrack) {
261 mFocusTrack = nTrack;
262 }
263
269 void SetHasFocusTrack(int bHasFocusTrack) {
270 mHasFocusTrack = bHasFocusTrack;
271 }
272
273private:
274 GfxTunnel *mTunnel;
275 std::list<Transform> mTransforms;
276 std::vector<std::unique_ptr<MeshGroup>> mMeshGroups;
278 std::vector<std::unique_ptr<SpriteGroup>> mSpriteGroups;
279 std::list<std::unique_ptr<RndObject>> mObjects;
280 std::list<TnlGem> mGems;
281 float mTrailTicks;
282 int mMaxGems;
283 char mFocusTrack;
284 int mHasFocusTrack;
285
294 static void SetRenderScale(RndObject *pObject, float flScale);
295
304 static void SetRenderScale(RndMesh *pMesh, float flScale);
305
316 static void ApplyRenderScales(float flWorldScale);
317
333 static void AddRotation(RndMesh *pMesh,
334 std::list<std::unique_ptr<RndObject>> *pObjects,
335 int nKeys,
336 int bLoop,
337 RndAnimatable *pParent,
338 float flStartFrame,
339 float flStartAngle,
340 float flEndFrame,
341 float flEndAngle);
342
351 std::list<TnlGem>::iterator FindNearest(float flTick);
352
361 std::list<TnlGem>::iterator FindLowerBound(float flTick);
362};
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
The gems of one type and distance, drawn as the instances of a multimesh.
Definition meshgroup.h:19
Mix-in for an object driven by a frame.
Definition rndanimatable.h:16
Triangle mesh with a material.
Definition rndmesh.h:31
Base of every object the renderer can load, resolve by name, and serialise.
Definition rndobject.h:20
The sprite gems of one type, drawn as the particles of a particle system.
Definition spritegroup.h:10
void Poll(const TnlTrackRange *pRange)
Drop the gems behind the song and far ahead of it, fire the events of the gems that pass,...
static void LoadConfig(DataArray *pConfig, DataArray *pDefaults, GfxTunnel *pTunnel, int nOption)
Load the shared settings of the gems.
static void ApplyRenderScales()
Scale the meshes and particle systems of the gems by the world length of a tick.
void RemoveGem(char nTrack, char nSlot, float flTick)
Remove the gems of a tick, slot, and track.
MeshGroup * GetMeshGroup(char nType)
Report the first mesh group of a gem type.
void SetHasFocusTrack(int bHasFocusTrack)
Set whether the focus track applies.
Definition tnlgems.h:269
std::list< TnlGem > & GetGemList()
Definition tnlgems.h:251
char AddSpriteGroup(const char *pszName)
Add a sprite group for the particle system <name>.ps.
SpriteGroup * GetSpriteGroup(char nType)
Report the sprite group of a gem type.
char AddMeshGroups(const char *pszName, const char *pszDrawParent, float flLookahead)
Add one mesh group for each multimesh <name><n>.mm, chained in that order.
~TnlGems()
Delete the groups and the animations the gems created.
void Clear()
Remove every gem.
std::list< TnlGem >::iterator Find(float flTick)
Find the first gem at or after a tick.
void AddRotations(char nType, int nKeys, int bLoop, RndAnimatable *pParent, float flStartFrame, float flStartAngle, float flEndFrame, float flEndAngle)
Add an animation that turns each mesh of the groups of a gem type.
void DrawComposites()
Draw the composite mesh groups, each mesh through the multimesh in turn.
TnlGems(GfxTunnel *pTunnel, int nMaxGems, int nNumTracks)
Construct an empty set of gems with a pool of instance transforms.
void AddGem(char nTrack, char nType, char nSlot, int bFlash, char nColor, float flTick, float flShowTick)
Add a gem, and set the removal of a gem of the same tick, slot, and track to its show tick.
void ClearInstances(const char *pszName)
Empty the instances of each multimesh <name><n>.mm.
void SetFocusTrack(char nTrack)
Set the track whose passing gems fire hit events.
Definition tnlgems.h:260
void RemoveGems(char nTrack, float flStartTick, float flEndTick)
Remove the gems of a track over a span of ticks.
char AddCompositeMeshGroups(const char *pszName, const char *pszDrawParent, float flLookahead)
Add one composite mesh group for each multimesh <name>_<n>.mm, chained in that order.
std::list< TnlGem >::iterator LowerBound(float flTick)
Find the first gem at or after a tick.
A run of tracks over a span of ticks, which the tunnel reports when the region changes.
Definition tnltrackrange.h:8