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