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