1#ifndef GAME_EDITOR_MAPITEMS_ENVELOPE_H
2#define GAME_EDITOR_MAPITEMS_ENVELOPE_H
3
4#include <game/client/render.h>
5#include <game/mapitems.h>
6
7class CEnvelope
8{
9public:
10 std::vector<CEnvPoint_runtime> m_vPoints;
11 char m_aName[32] = "";
12 bool m_Synchronized = false;
13
14 enum class EType
15 {
16 POSITION,
17 COLOR,
18 SOUND
19 };
20 explicit CEnvelope(EType Type);
21 explicit CEnvelope(int NumChannels);
22
23 std::pair<float, float> GetValueRange(int ChannelMask);
24 void Eval(float Time, ColorRGBA &Result, size_t Channels);
25 void AddPoint(int Time, int v0, int v1 = 0, int v2 = 0, int v3 = 0);
26 float EndTime() const;
27 int GetChannels() const;
28 EType Type() const { return m_Type; }
29
30private:
31 void Resort();
32
33 EType m_Type;
34
35 class CEnvelopePointAccess : public IEnvelopePointAccess
36 {
37 std::vector<CEnvPoint_runtime> *m_pvPoints;
38
39 public:
40 CEnvelopePointAccess(std::vector<CEnvPoint_runtime> *pvPoints);
41
42 int NumPoints() const override;
43 const CEnvPoint *GetPoint(int Index) const override;
44 const CEnvPointBezier *GetBezier(int Index) const override;
45 };
46 CEnvelopePointAccess m_PointsAccess;
47};
48
49#endif
50