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