FastLED 3.9.15
Loading...
Searching...
No Matches
spiral_matrix8.cpp.hpp
Go to the documentation of this file.
5
8
9namespace fl {
10
12 auto *e = ctx.mEngine.get();
13 e->get_ready();
14
15 e->timings.master_speed = 0.005;
16 e->timings.ratio[0] = 0.025;
17 e->timings.ratio[1] = 0.027;
18 e->timings.ratio[2] = 0.031;
19 e->timings.ratio[3] = 0.0053;
20 e->timings.ratio[4] = 0.0056;
21 e->timings.ratio[5] = 0.01;
22
23 e->calculate_oscillators(e->timings);
24
25 for (int x = 0; x < e->num_x; x++) {
26 for (int y = 0; y < e->num_y; y++) {
27
28 e->animation.dist = e->distance[x][y];
29 e->animation.angle = 2;
30 e->animation.z = 5;
31 e->animation.scale_x = 0.15;
32 e->animation.scale_y = 0.15;
33 e->animation.offset_z = 0;
34 e->animation.offset_y = 50 * e->move.linear[0];
35 e->animation.offset_x = 0;
36 e->animation.low_limit = 0;
37 float show1 = e->render_value(e->animation);
38
39 e->animation.dist = e->distance[x][y];
40 e->animation.angle = 2;
41 e->animation.z = 150;
42 e->animation.offset_x = -50 * e->move.linear[0];
43 float show2 = e->render_value(e->animation);
44
45 e->animation.dist = e->distance[x][y];
46 e->animation.angle = 1;
47 e->animation.z = 550;
48 e->animation.scale_x = 0.15;
49 e->animation.scale_y = 0.15;
50 e->animation.offset_x = 0;
51 e->animation.offset_y = -50 * e->move.linear[1];
52 float show4 = e->render_value(e->animation);
53
54 e->animation.dist = e->distance[x][y];
55 e->animation.angle = 1;
56 e->animation.z = 1250;
57 e->animation.scale_x = 0.15;
58 e->animation.scale_y = 0.15;
59 e->animation.offset_x = 0;
60 e->animation.offset_y = 50 * e->move.linear[1];
61 float show5 = e->render_value(e->animation);
62
63 e->show3 = e->add(show1, show2);
64 e->show6 = e->screen(show4, show5);
65
66 e->pixel.red = e->show3;
67 e->pixel.green = 0;
68 e->pixel.blue = e->show6;
69
70 e->pixel = e->rgb_sanity_check(e->pixel);
71
72 e->setPixelColorInternal(x, y, e->pixel);
73 }
74 }
75}
76
77
78// ============================================================================
79// Fixed-Point Implementation of SpiralMatrix8
80// ============================================================================
81
83 auto *e = ctx.mEngine.get();
84 e->get_ready();
85 mState.ensureCache(e);
86 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
87 const fl::u8 *perm = PERLIN_NOISE;
88
89 e->timings.master_speed = 0.005;
90 e->timings.ratio[0] = 0.025;
91 e->timings.ratio[1] = 0.027;
92 e->timings.ratio[2] = 0.031;
93 e->timings.ratio[3] = 0.0053;
94 e->timings.ratio[4] = 0.0056;
95 e->timings.ratio[5] = 0.01;
96
97 e->calculate_oscillators(e->timings);
98
99 for (int x = 0; x < e->num_x; x++) {
100 for (int y = 0; y < e->num_y; y++) {
101
102 e->animation.dist = e->distance[x][y];
103 e->animation.angle = 2;
104 e->animation.z = 5;
105 e->animation.scale_x = 0.15;
106 e->animation.scale_y = 0.15;
107 e->animation.offset_z = 0;
108 e->animation.offset_y = 50 * e->move.linear[0];
109 e->animation.offset_x = 0;
110 e->animation.low_limit = 0;
111 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
112
113 e->animation.dist = e->distance[x][y];
114 e->animation.angle = 2;
115 e->animation.z = 150;
116 e->animation.offset_x = -50 * e->move.linear[0];
117 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
118
119 e->animation.dist = e->distance[x][y];
120 e->animation.angle = 1;
121 e->animation.z = 550;
122 e->animation.scale_x = 0.15;
123 e->animation.scale_y = 0.15;
124 e->animation.offset_x = 0;
125 e->animation.offset_y = -50 * e->move.linear[1];
126 float show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
127
128 e->animation.dist = e->distance[x][y];
129 e->animation.angle = 1;
130 e->animation.z = 1250;
131 e->animation.scale_x = 0.15;
132 e->animation.scale_y = 0.15;
133 e->animation.offset_x = 0;
134 e->animation.offset_y = 50 * e->move.linear[1];
135 float show5 = render_value_fp_from_float(e->animation, fade_lut, perm);
136
137 e->show3 = e->add(show1, show2);
138 e->show6 = e->screen(show4, show5);
139
140 e->pixel.red = e->show3;
141 e->pixel.green = 0;
142 e->pixel.blue = e->show6;
143
144 e->pixel = e->rgb_sanity_check(e->pixel);
145
146 e->setPixelColorInternal(x, y, e->pixel);
147 }
148 }
149}
150
151} // namespace fl
152
void draw(Context &ctx) override
void draw(Context &ctx) override
unsigned char u8
Definition s16x16x4.h:132
T * assume_aligned(T *ptr) FL_NOEXCEPT
Definition s16x16x4.h:126
FASTLED_FORCE_INLINE fl::i32 render_value_fp_from_float(const render_parameters &anim, const fl::i32 *fade_lut, const fl::u8 *perm)
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_OPTIMIZATION_LEVEL_O3_BEGIN
#define FL_FAST_MATH_BEGIN
#define FL_FAST_MATH_END
#define FL_OPTIMIZATION_LEVEL_O3_END
fl::unique_ptr< Engine > mEngine
Definition context.h:38