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