resonance 1.0.1
Loading...
Searching...
No Matches
durgemtrails.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4#include <vector>
5
6#include "app/durgemcurve.h"
7#include "os/hxstr.h"
8
9class AppTunnel;
10class DurGemRowString;
11class DurGemStrip;
12struct Color;
13struct Vector3;
14namespace Rnd {
15class Mat;
16class View;
17} // namespace Rnd
18
32public:
34 enum { kSegmentPointCount = 9 };
35
47 DurGemTrails(AppTunnel *pTunnel, int nMaxPoints);
48
58
68 void CreateLane(float flWidth, int nLane, Rnd::Mat *pMat);
69
87 void AddSegment(int nLane,
88 const Color &color,
89 float flStartFrame,
90 float flStartBlend,
91 float flEndFrame,
92 float flEndBlend);
93
103 void EndTrail(int nLane, int nRow);
104
119 void StartStrip(int nLane, const Color &color, int nId, float flFrame, float flBlend);
120
129 void StopStrip(int nId, float flFrame);
130
143 void Update(float flFrame);
144
156
157private:
164 DurGemRowString *GetRowString(int nLane, int nRow);
165
173 static void SubdivideSegment(int nLane,
174 Vector3 *pPoints,
175 int nFirst,
176 int nLast,
177 float flStartFrame,
178 float flStartBlend,
179 float flEndFrame,
180 float flEndBlend);
181
191 static bool NeedsSubdivision(int nLane,
192 const Vector3 &first,
193 const Vector3 &last,
194 float *pMidFrame,
195 float *pMidBlend,
196 Vector3 *pMidPoint,
197 float flStartFrame,
198 float flStartBlend,
199 float flEndFrame,
200 float flEndBlend);
201
210 static std::list<DurGemCurve>::iterator FindFirstCurve(std::list<DurGemCurve> &curves,
211 int nRow);
212
213 // A signed remainder moved into [0, nCount).
214 static int WrapIndex(int nIndex, int nCount) {
215 const int nRemainder = nIndex % nCount;
216 return nRemainder > -1 ? nRemainder : nRemainder + nCount;
217 }
218
219 int mLaneCount;
220 int mRowCount;
221 int mMaxPoints;
222 std::vector<DurGemRowString *> mRows; // Row-major, mRowCount rows of mLaneCount lanes.
223 std::vector<DurGemStrip *> mStrips;
224 std::list<DurGemCurve> mCurves; // Sorted by DurGemCurve::mRow.
225 Rnd::View *mView; // `tnl strings`
226 AppTunnel *mTunnel;
227};
228
235extern int g_nDurGemStringCount;
Game-side driver of the tunnel the in-game renderer draws.
Definition apptunnel.h:88
Straight segments of one lane of one tunnel slice, drawn as line pairs of one ribbon.
Definition durgemrowstring.h:23
Live trail of one held durable gem, a two-point ribbon that grows with the playhead.
Definition durgemstrip.h:21
@ kSegmentPointCount
Definition durgemtrails.h:34
void StopStrip(int nId, float flFrame)
Stop the live trail nId at flFrame.
~DurGemTrails()
Delete the row strings and the strips.
void CreateLane(float flWidth, int nLane, Rnd::Mat *pMat)
Create the row strings of lane nLane for every slice row.
static HxStr NewStringName()
Increment g_nDurGemStringCount and format the next ribbon name.
DurGemTrails(AppTunnel *pTunnel, int nMaxPoints)
Allocate the row table and six strips, and resolve the view "tnl strings".
void Update(float flFrame)
Show the ribbons of the slice rows from 480 frames behind flFrame onward and advance the strips.
void EndTrail(int nLane, int nRow)
Clear the row string of lane nLane in slice row nRow and erase the curves of that lane and row.
void StartStrip(int nLane, const Color &color, int nId, float flFrame, float flBlend)
Hand a new live trail to the first free strip.
void AddSegment(int nLane, const Color &color, float flStartFrame, float flStartBlend, float flEndFrame, float flEndBlend)
Add a segment of lane nLane between two tunnel positions.
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Root of a loadable scene.
Definition view.h:47
int g_nDurGemStringCount
Number of ribbon names DurGemTrails::NewStringName() and its inlined copies have issued.
The rendering engine.
Definition animhelper.h:3
Linear colour with four float components.
Definition color.h:10
Three-component vector, padded to a PlayStation 2 quadword.
Definition vector3.h:12