ddnet/src/game/editor/mapitems/envelope.h

49 lines
1 KiB
C
Raw Normal View History

2023-10-05 20:42:24 +00:00
#ifndef GAME_EDITOR_MAPITEMS_ENVELOPE_H
#define GAME_EDITOR_MAPITEMS_ENVELOPE_H
#include <game/client/render.h>
#include <game/mapitems.h>
2023-10-05 20:42:24 +00:00
class CEnvelope
{
public:
std::vector<CEnvPoint_runtime> m_vPoints;
char m_aName[32] = "";
bool m_Synchronized = false;
2023-10-05 20:42:24 +00:00
2023-10-05 21:16:47 +00:00
enum class EType
{
POSITION,
COLOR,
SOUND
};
explicit CEnvelope(EType Type);
explicit CEnvelope(int NumChannels);
2023-10-05 20:42:24 +00:00
std::pair<float, float> GetValueRange(int ChannelMask);
int Eval(float Time, ColorRGBA &Color);
void AddPoint(int Time, int v0, int v1 = 0, int v2 = 0, int v3 = 0);
float EndTime() const;
int GetChannels() const;
2023-10-05 21:16:47 +00:00
private:
2023-10-05 21:34:39 +00:00
void Resort();
2023-10-05 21:16:47 +00:00
EType m_Type;
2023-10-06 09:34:40 +00:00
class CEnvelopePointAccess : public IEnvelopePointAccess
{
std::vector<CEnvPoint_runtime> *m_pvPoints;
public:
CEnvelopePointAccess(std::vector<CEnvPoint_runtime> *pvPoints);
int NumPoints() const override;
const CEnvPoint *GetPoint(int Index) const override;
const CEnvPointBezier *GetBezier(int Index) const override;
};
CEnvelopePointAccess m_PointsAccess;
2023-10-05 20:42:24 +00:00
};
#endif