-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoutineExpand.h
64 lines (50 loc) · 1.31 KB
/
RoutineExpand.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifdef GEOM_DOME
#pragma once
#include <cmath>
#include "Routine.h"
#include "FastLED.h"
class CDome;
class CPixelArray;
class CRoutineExpand : public CRoutine
{
public:
static constexpr size_t c_alloc_qty = 1;
static constexpr size_t c_delay_ms = 10000;
static constexpr size_t c_group_ms = 1000;
static constexpr float c_q = 3;
public:
CRoutineExpand(CPixelArray* pixels);
~CRoutineExpand();
public:
virtual void Continue() override;
virtual const char* GetName() override { return "Expand"; }
public:
enum ShapeGroup
{
InnerHex,
OuterHex,
Other,
All,
};
private:
size_t m_color_index = 0;
size_t m_last_run = 0;
ShapeGroup m_shape_group = All;
private:
CDome* GetDome();
void Advance();
float CalculateBrightness();
bool isLit(size_t shape_index);
private:
static CMemoryPool<CRoutineExpand, c_alloc_qty> s_pool;
public:
void* operator new(size_t)
{
return s_pool.alloc();
}
void operator delete(void* ptr)
{
s_pool.free(reinterpret_cast<CRoutineExpand*>(ptr));
}
};
#endif // GEOM_DOME