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