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