FastLED 3.10.8
Loading...
Searching...
No Matches
spiral_matrix6.cpp.hpp
Go to the documentation of this file.
5#include "fl/stl/noexcept.h"
6
9
10namespace fl {
11
13 auto *e = ctx.mEngine.get();
14 e->get_ready();
15
16 e->timings.master_speed = 0.03;
17 e->timings.ratio[0] = 0.025;
18 e->timings.ratio[1] = 0.027;
19 e->timings.ratio[2] = 0.031;
20 e->timings.ratio[3] = 0.0053;
21 e->timings.ratio[4] = 0.0056;
22 e->timings.ratio[5] = 0.0059;
23
24 e->calculate_oscillators(e->timings);
25
26 for (int x = 0; x < e->num_x; x++) {
27 for (int y = 0; y < e->num_y; y++) {
28
29 float s = 0.7;
30
31 e->animation.dist = e->distance[x][y] * (e->move.directional[0]) * s;
32 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
33 e->animation.z = 5;
34 e->animation.scale_x = 0.09;
35 e->animation.scale_y = 0.09;
36 e->animation.offset_z = 5 * e->move.linear[0];
37 e->animation.offset_x = 0;
38 e->animation.offset_y = 0;
39 float show1 = e->render_value(e->animation);
40
41 e->animation.dist = e->distance[x][y] * e->move.directional[1] * s;
42 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
43 e->animation.z = 50;
44 e->animation.scale_x = 0.07;
45 e->animation.scale_y = 0.07;
46 e->animation.offset_z = 5 * e->move.linear[1];
47 e->animation.offset_x = 0;
48 e->animation.offset_y = 0;
49 float show2 = e->render_value(e->animation);
50
51 e->animation.dist = e->distance[x][y] * e->move.directional[2] * s;
52 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2];
53 e->animation.z = 500;
54 e->animation.scale_x = 0.05;
55 e->animation.scale_y = 0.05;
56 e->animation.offset_z = 5 * e->move.linear[2];
57 e->animation.offset_x = 0;
58 e->animation.offset_y = 0;
59 float show3 = e->render_value(e->animation);
60
61 e->animation.dist = e->distance[x][y] * (e->move.directional[3]) * s;
62 e->animation.angle = e->polar_theta[x][y] + e->move.radial[3];
63 e->animation.z = 5;
64 e->animation.scale_x = 0.09;
65 e->animation.scale_y = 0.09;
66 e->animation.offset_z = 5 * e->move.linear[3];
67 e->animation.offset_x = 0;
68 e->animation.offset_y = 0;
69 float show4 = e->render_value(e->animation);
70
71 e->animation.dist = e->distance[x][y] * e->move.directional[4] * s;
72 e->animation.angle = e->polar_theta[x][y] + e->move.radial[4];
73 e->animation.z = 50;
74 e->animation.scale_x = 0.07;
75 e->animation.scale_y = 0.07;
76 e->animation.offset_z = 5 * e->move.linear[4];
77 e->animation.offset_x = 0;
78 e->animation.offset_y = 0;
79 float show5 = e->render_value(e->animation);
80
81 e->animation.dist = e->distance[x][y] * e->move.directional[5] * s;
82 e->animation.angle = e->polar_theta[x][y] + e->move.radial[5];
83 e->animation.z = 500;
84 e->animation.scale_x = 0.05;
85 e->animation.scale_y = 0.05;
86 e->animation.offset_z = 5 * e->move.linear[5];
87 e->animation.offset_x = 0;
88 e->animation.offset_y = 0;
89 float show6 = e->render_value(e->animation);
90
91 float radius = e->radial_filter_radius;
92 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
93
94 e->show7 = e->screen(show1, show4);
95 e->show8 = e->colordodge(show2, show5);
96 e->show9 = e->screen(show3, show6);
97
98 e->pixel.red = radial * (e->show7 + e->show8);
99 e->pixel.green = 0;
100 e->pixel.blue = radial * e->show9;
101
102 e->pixel = e->rgb_sanity_check(e->pixel);
103
104 e->setPixelColorInternal(x, y, e->pixel);
105 }
106 }
107}
108
109
110// ============================================================================
111// Fixed-Point Implementation of SpiralMatrix6
112// ============================================================================
113
115 auto *e = ctx.mEngine.get();
116 e->get_ready();
117 mState.ensureCache(e);
118 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
119 const fl::u8 *perm = PERLIN_NOISE;
120
121 e->timings.master_speed = 0.03;
122 e->timings.ratio[0] = 0.025;
123 e->timings.ratio[1] = 0.027;
124 e->timings.ratio[2] = 0.031;
125 e->timings.ratio[3] = 0.0053;
126 e->timings.ratio[4] = 0.0056;
127 e->timings.ratio[5] = 0.0059;
128
129 e->calculate_oscillators(e->timings);
130
131 for (int x = 0; x < e->num_x; x++) {
132 for (int y = 0; y < e->num_y; y++) {
133
134 float s = 0.7;
135
136 e->animation.dist = e->distance[x][y] * (e->move.directional[0]) * s;
137 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
138 e->animation.z = 5;
139 e->animation.scale_x = 0.09;
140 e->animation.scale_y = 0.09;
141 e->animation.offset_z = 5 * e->move.linear[0];
142 e->animation.offset_x = 0;
143 e->animation.offset_y = 0;
144 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
145
146 e->animation.dist = e->distance[x][y] * e->move.directional[1] * s;
147 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
148 e->animation.z = 50;
149 e->animation.scale_x = 0.07;
150 e->animation.scale_y = 0.07;
151 e->animation.offset_z = 5 * e->move.linear[1];
152 e->animation.offset_x = 0;
153 e->animation.offset_y = 0;
154 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
155
156 e->animation.dist = e->distance[x][y] * e->move.directional[2] * s;
157 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2];
158 e->animation.z = 500;
159 e->animation.scale_x = 0.05;
160 e->animation.scale_y = 0.05;
161 e->animation.offset_z = 5 * e->move.linear[2];
162 e->animation.offset_x = 0;
163 e->animation.offset_y = 0;
164 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
165
166 e->animation.dist = e->distance[x][y] * (e->move.directional[3]) * s;
167 e->animation.angle = e->polar_theta[x][y] + e->move.radial[3];
168 e->animation.z = 5;
169 e->animation.scale_x = 0.09;
170 e->animation.scale_y = 0.09;
171 e->animation.offset_z = 5 * e->move.linear[3];
172 e->animation.offset_x = 0;
173 e->animation.offset_y = 0;
174 float show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
175
176 e->animation.dist = e->distance[x][y] * e->move.directional[4] * s;
177 e->animation.angle = e->polar_theta[x][y] + e->move.radial[4];
178 e->animation.z = 50;
179 e->animation.scale_x = 0.07;
180 e->animation.scale_y = 0.07;
181 e->animation.offset_z = 5 * e->move.linear[4];
182 e->animation.offset_x = 0;
183 e->animation.offset_y = 0;
184 float show5 = render_value_fp_from_float(e->animation, fade_lut, perm);
185
186 e->animation.dist = e->distance[x][y] * e->move.directional[5] * s;
187 e->animation.angle = e->polar_theta[x][y] + e->move.radial[5];
188 e->animation.z = 500;
189 e->animation.scale_x = 0.05;
190 e->animation.scale_y = 0.05;
191 e->animation.offset_z = 5 * e->move.linear[5];
192 e->animation.offset_x = 0;
193 e->animation.offset_y = 0;
194 float show6 = render_value_fp_from_float(e->animation, fade_lut, perm);
195
196 float radius = e->radial_filter_radius;
197 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
198
199 e->show7 = e->screen(show1, show4);
200 e->show8 = e->colordodge(show2, show5);
201 e->show9 = e->screen(show3, show6);
202
203 e->pixel.red = radial * (e->show7 + e->show8);
204 e->pixel.green = 0;
205 e->pixel.blue = radial * e->show9;
206
207 e->pixel = e->rgb_sanity_check(e->pixel);
208
209 e->setPixelColorInternal(x, y, e->pixel);
210 }
211 }
212}
213
214} // namespace fl
215
void draw(Context &ctx) FL_NO_EXCEPT override
void draw(Context &ctx) FL_NO_EXCEPT override
#define FL_OPTIMIZATION_LEVEL_O3_BEGIN
#define FL_FAST_MATH_BEGIN
#define FL_FAST_MATH_END
#define FL_OPTIMIZATION_LEVEL_O3_END
T * assume_aligned(T *ptr) FL_NO_EXCEPT
Definition s16x16x4.h:126
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
FASTLED_FORCE_INLINE fl::i32 render_value_fp_from_float(const render_parameters &anim, const fl::i32 *fade_lut, const fl::u8 *perm) FL_NO_EXCEPT
Base definition for an LED controller.
Definition crgb.hpp:179