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