FastLED 3.10.8
Loading...
Searching...
No Matches
complex_kaleido.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.009;
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 e->animation.dist = e->distance[x][y];
30 e->animation.angle = 5 * e->polar_theta[x][y] + 10 * e->move.radial[0] +
31 e->animation.dist / 2;
32 e->animation.z = 5;
33 e->animation.scale_x = 0.07;
34 e->animation.scale_y = 0.07;
35 e->animation.offset_z = 0;
36 e->animation.offset_x = -30 * e->move.linear[0];
37 e->animation.offset_y = 0;
38 e->animation.low_limit = 0;
39 e->show1 = e->render_value(e->animation);
40
41 e->animation.dist = e->distance[x][y];
42 e->animation.angle = -5 * e->polar_theta[x][y] + 12 * e->move.radial[1] +
43 e->animation.dist / 2;
44 e->animation.z = 500;
45 e->animation.scale_x = 0.07;
46 e->animation.scale_y = 0.07;
47 e->animation.offset_z = 0;
48 e->animation.offset_x = -30 * e->move.linear[1];
49 e->animation.offset_y = 0;
50 e->animation.low_limit = 0;
51 e->show2 = e->render_value(e->animation);
52
53 e->animation.dist = e->distance[x][y];
54 e->animation.angle = -5 * e->polar_theta[x][y] + 12 * e->move.radial[2] +
55 e->animation.dist / 2;
56 e->animation.z = 500;
57 e->animation.scale_x = 0.05;
58 e->animation.scale_y = 0.05;
59 e->animation.offset_z = 0;
60 e->animation.offset_x = -40 * e->move.linear[2];
61 e->animation.offset_y = 0;
62 e->animation.low_limit = 0;
63 e->show3 = e->render_value(e->animation);
64
65 e->animation.dist = e->distance[x][y];
66 e->animation.angle = 5 * e->polar_theta[x][y] + 12 * e->move.radial[3] +
67 e->animation.dist / 2;
68 e->animation.z = 500;
69 e->animation.scale_x = 0.09;
70 e->animation.scale_y = 0.09;
71 e->animation.offset_z = 0;
72 e->animation.offset_x = -35 * e->move.linear[3];
73 e->animation.offset_y = 0;
74 e->animation.low_limit = 0;
75 e->show4 = e->render_value(e->animation);
76
77 e->show5 = e->screen(e->show4, e->show3);
78 e->show6 = e->colordodge(e->show2, e->show3);
79
80 float radius = e->radial_filter_radius;
81 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
82
83 e->pixel.red = radial * (e->show1 + e->show2);
84 e->pixel.green = 0.3 * radial * e->show6;
85 e->pixel.blue = radial * e->show5;
86
87 e->pixel = e->rgb_sanity_check(e->pixel);
88
89 e->setPixelColorInternal(x, y, e->pixel);
90 }
91 }
92}
93
94
95// ============================================================================
96// Fixed-Point Implementation of Complex_Kaleido
97// ============================================================================
98
100 auto *e = ctx.mEngine.get();
101 e->get_ready();
102 mState.ensureCache(e);
103 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
104 const fl::u8 *perm = PERLIN_NOISE;
105
106 e->timings.master_speed = 0.009;
107 e->timings.ratio[0] = 0.025;
108 e->timings.ratio[1] = 0.027;
109 e->timings.ratio[2] = 0.031;
110 e->timings.ratio[3] = 0.0053;
111 e->timings.ratio[4] = 0.0056;
112 e->timings.ratio[5] = 0.0059;
113
114 e->calculate_oscillators(e->timings);
115
116 for (int x = 0; x < e->num_x; x++) {
117 for (int y = 0; y < e->num_y; y++) {
118
119 e->animation.dist = e->distance[x][y];
120 e->animation.angle = 5 * e->polar_theta[x][y] + 10 * e->move.radial[0] +
121 e->animation.dist / 2;
122 e->animation.z = 5;
123 e->animation.scale_x = 0.07;
124 e->animation.scale_y = 0.07;
125 e->animation.offset_z = 0;
126 e->animation.offset_x = -30 * e->move.linear[0];
127 e->animation.offset_y = 0;
128 e->animation.low_limit = 0;
129 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
130
131 e->animation.dist = e->distance[x][y];
132 e->animation.angle = -5 * e->polar_theta[x][y] + 12 * e->move.radial[1] +
133 e->animation.dist / 2;
134 e->animation.z = 500;
135 e->animation.scale_x = 0.07;
136 e->animation.scale_y = 0.07;
137 e->animation.offset_z = 0;
138 e->animation.offset_x = -30 * e->move.linear[1];
139 e->animation.offset_y = 0;
140 e->animation.low_limit = 0;
141 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
142
143 e->animation.dist = e->distance[x][y];
144 e->animation.angle = -5 * e->polar_theta[x][y] + 12 * e->move.radial[2] +
145 e->animation.dist / 2;
146 e->animation.z = 500;
147 e->animation.scale_x = 0.05;
148 e->animation.scale_y = 0.05;
149 e->animation.offset_z = 0;
150 e->animation.offset_x = -40 * e->move.linear[2];
151 e->animation.offset_y = 0;
152 e->animation.low_limit = 0;
153 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
154
155 e->animation.dist = e->distance[x][y];
156 e->animation.angle = 5 * e->polar_theta[x][y] + 12 * e->move.radial[3] +
157 e->animation.dist / 2;
158 e->animation.z = 500;
159 e->animation.scale_x = 0.09;
160 e->animation.scale_y = 0.09;
161 e->animation.offset_z = 0;
162 e->animation.offset_x = -35 * e->move.linear[3];
163 e->animation.offset_y = 0;
164 e->animation.low_limit = 0;
165 e->show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
166
167 e->show5 = e->screen(e->show4, e->show3);
168 e->show6 = e->colordodge(e->show2, e->show3);
169
170 float radius = e->radial_filter_radius;
171 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
172
173 e->pixel.red = radial * (e->show1 + e->show2);
174 e->pixel.green = 0.3 * radial * e->show6;
175 e->pixel.blue = radial * e->show5;
176
177 e->pixel = e->rgb_sanity_check(e->pixel);
178
179 e->setPixelColorInternal(x, y, e->pixel);
180 }
181 }
182}
183
184} // namespace fl
185
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