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