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