FastLED 3.9.15
Loading...
Searching...
No Matches
complex_kaleido_3.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.001;
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.033;
20 e->timings.ratio[4] = 0.037;
21 e->timings.ratio[5] = 0.038;
22 e->timings.ratio[5] = 0.041;
23
24 e->calculate_oscillators(e->timings);
25
26 float size = 0.4 + e->move.directional[0] * 0.1;
27
28 float q = 2;
29
30 for (int x = 0; x < e->num_x; x++) {
31 for (int y = 0; y < e->num_y; y++) {
32
33 e->animation.dist = e->distance[x][y];
34 e->animation.angle =
35 5 * e->polar_theta[x][y] + 10 * e->move.radial[0] +
36 e->animation.dist / (((e->move.directional[0] + 3) * 2)) +
37 e->move.noise_angle[0] * q;
38 e->animation.z = 5;
39 e->animation.scale_x = 0.08 * size * (e->move.directional[0] + 1.5);
40 e->animation.scale_y = 0.07 * size;
41 e->animation.offset_z = -10 * e->move.linear[0];
42 e->animation.offset_x = -30 * e->move.linear[0];
43 e->animation.offset_y = 0;
44 e->animation.low_limit = 0;
45 e->show1 = e->render_value(e->animation);
46
47 e->animation.dist = e->distance[x][y];
48 e->animation.angle =
49 -5 * e->polar_theta[x][y] + 10 * e->move.radial[1] +
50 e->animation.dist / (((e->move.directional[1] + 3) * 2)) +
51 e->move.noise_angle[1] * q;
52 e->animation.z = 500;
53 e->animation.scale_x = 0.07 * size * (e->move.directional[1] + 1.1);
54 e->animation.scale_y = 0.07 * size * (e->move.directional[2] + 1.3);
55 ;
56 e->animation.offset_z = -12 * e->move.linear[1];
57 ;
58 e->animation.offset_x = -(e->num_x - 1) * e->move.linear[1];
59 e->animation.offset_y = 0;
60 e->animation.low_limit = 0;
61 e->show2 = e->render_value(e->animation);
62
63 e->animation.dist = e->distance[x][y];
64 e->animation.angle =
65 -5 * e->polar_theta[x][y] + 12 * e->move.radial[2] +
66 e->animation.dist / (((e->move.directional[3] + 3) * 2)) +
67 e->move.noise_angle[2] * q;
68 e->animation.z = 500;
69 e->animation.scale_x = 0.05 * size * (e->move.directional[3] + 1.5);
70 ;
71 e->animation.scale_y = 0.05 * size * (e->move.directional[4] + 1.5);
72 ;
73 e->animation.offset_z = -12 * e->move.linear[3];
74 e->animation.offset_x = -40 * e->move.linear[3];
75 e->animation.offset_y = 0;
76 e->animation.low_limit = 0;
77 e->show3 = e->render_value(e->animation);
78
79 e->animation.dist = e->distance[x][y];
80 e->animation.angle =
81 5 * e->polar_theta[x][y] + 12 * e->move.radial[3] +
82 e->animation.dist / (((e->move.directional[5] + 3) * 2)) +
83 e->move.noise_angle[3] * q;
84 e->animation.z = 500;
85 e->animation.scale_x = 0.09 * size * (e->move.directional[5] + 1.5);
86 ;
87 ;
88 e->animation.scale_y = 0.09 * size * (e->move.directional[6] + 1.5);
89 ;
90 ;
91 e->animation.offset_z = 0;
92 e->animation.offset_x = -35 * e->move.linear[3];
93 e->animation.offset_y = 0;
94 e->animation.low_limit = 0;
95 e->show4 = e->render_value(e->animation);
96
97 e->show5 = e->screen(e->show4, e->show3) - e->show2;
98 e->show6 = e->colordodge(e->show4, e->show1);
99
100 e->show7 = e->multiply(e->show1, e->show2);
101
102 float linear1 = y / 32.f;
103
104 float radius = e->radial_filter_radius;
105 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
106
107 e->show7 = e->multiply(e->show1, e->show2) * linear1 * 2;
108 e->show8 = e->subtract(e->show7, e->show5);
109
110 e->pixel.green = 0.2 * e->show8;
111 e->pixel.blue = e->show5 * radial;
112 e->pixel.red = (1 * e->show1 + 1 * e->show2) - e->show7 / 2;
113
114 e->pixel = e->rgb_sanity_check(e->pixel);
115
116 e->setPixelColorInternal(x, y, e->pixel);
117 }
118 }
119}
120
121
122// ============================================================================
123// Fixed-Point Implementation of Complex_Kaleido_3
124// ============================================================================
125
127 auto *e = ctx.mEngine.get();
128 e->get_ready();
129 mState.ensureCache(e);
130 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
131 const fl::u8 *perm = PERLIN_NOISE;
132
133 e->timings.master_speed = 0.001;
134 e->timings.ratio[0] = 0.025;
135 e->timings.ratio[1] = 0.027;
136 e->timings.ratio[2] = 0.031;
137 e->timings.ratio[3] = 0.033;
138 e->timings.ratio[4] = 0.037;
139 e->timings.ratio[5] = 0.038;
140 e->timings.ratio[5] = 0.041;
141
142 e->calculate_oscillators(e->timings);
143
144 float size = 0.4 + e->move.directional[0] * 0.1;
145
146 float q = 2;
147
148 for (int x = 0; x < e->num_x; x++) {
149 for (int y = 0; y < e->num_y; y++) {
150
151 e->animation.dist = e->distance[x][y];
152 e->animation.angle =
153 5 * e->polar_theta[x][y] + 10 * e->move.radial[0] +
154 e->animation.dist / (((e->move.directional[0] + 3) * 2)) +
155 e->move.noise_angle[0] * q;
156 e->animation.z = 5;
157 e->animation.scale_x = 0.08 * size * (e->move.directional[0] + 1.5);
158 e->animation.scale_y = 0.07 * size;
159 e->animation.offset_z = -10 * e->move.linear[0];
160 e->animation.offset_x = -30 * e->move.linear[0];
161 e->animation.offset_y = 0;
162 e->animation.low_limit = 0;
163 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
164
165 e->animation.dist = e->distance[x][y];
166 e->animation.angle =
167 -5 * e->polar_theta[x][y] + 10 * e->move.radial[1] +
168 e->animation.dist / (((e->move.directional[1] + 3) * 2)) +
169 e->move.noise_angle[1] * q;
170 e->animation.z = 500;
171 e->animation.scale_x = 0.07 * size * (e->move.directional[1] + 1.1);
172 e->animation.scale_y = 0.07 * size * (e->move.directional[2] + 1.3);
173 ;
174 e->animation.offset_z = -12 * e->move.linear[1];
175 ;
176 e->animation.offset_x = -(e->num_x - 1) * e->move.linear[1];
177 e->animation.offset_y = 0;
178 e->animation.low_limit = 0;
179 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
180
181 e->animation.dist = e->distance[x][y];
182 e->animation.angle =
183 -5 * e->polar_theta[x][y] + 12 * e->move.radial[2] +
184 e->animation.dist / (((e->move.directional[3] + 3) * 2)) +
185 e->move.noise_angle[2] * q;
186 e->animation.z = 500;
187 e->animation.scale_x = 0.05 * size * (e->move.directional[3] + 1.5);
188 ;
189 e->animation.scale_y = 0.05 * size * (e->move.directional[4] + 1.5);
190 ;
191 e->animation.offset_z = -12 * e->move.linear[3];
192 e->animation.offset_x = -40 * e->move.linear[3];
193 e->animation.offset_y = 0;
194 e->animation.low_limit = 0;
195 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
196
197 e->animation.dist = e->distance[x][y];
198 e->animation.angle =
199 5 * e->polar_theta[x][y] + 12 * e->move.radial[3] +
200 e->animation.dist / (((e->move.directional[5] + 3) * 2)) +
201 e->move.noise_angle[3] * q;
202 e->animation.z = 500;
203 e->animation.scale_x = 0.09 * size * (e->move.directional[5] + 1.5);
204 ;
205 ;
206 e->animation.scale_y = 0.09 * size * (e->move.directional[6] + 1.5);
207 ;
208 ;
209 e->animation.offset_z = 0;
210 e->animation.offset_x = -35 * e->move.linear[3];
211 e->animation.offset_y = 0;
212 e->animation.low_limit = 0;
213 e->show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
214
215 e->show5 = e->screen(e->show4, e->show3) - e->show2;
216 e->show6 = e->colordodge(e->show4, e->show1);
217
218 e->show7 = e->multiply(e->show1, e->show2);
219
220 float linear1 = y / 32.f;
221
222 float radius = e->radial_filter_radius;
223 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
224
225 e->show7 = e->multiply(e->show1, e->show2) * linear1 * 2;
226 e->show8 = e->subtract(e->show7, e->show5);
227
228 e->pixel.green = 0.2 * e->show8;
229 e->pixel.blue = e->show5 * radial;
230 e->pixel.red = (1 * e->show1 + 1 * e->show2) - e->show7 / 2;
231
232 e->pixel = e->rgb_sanity_check(e->pixel);
233
234 e->setPixelColorInternal(x, y, e->pixel);
235 }
236 }
237}
238
239} // namespace fl
240
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