FastLED 3.10.8
Loading...
Searching...
No Matches
spiral_matrix1.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.02;
17 e->timings.ratio[0] = 0.0025;
18 e->timings.ratio[1] = 0.0027;
19 e->timings.ratio[2] = 0.0031;
20 e->timings.ratio[3] = 0.0033;
21 e->timings.ratio[4] = 0.0036;
22 e->timings.ratio[5] = 0.0039;
23
24 e->calculate_oscillators(e->timings);
25
26 for (int x = 0; x < e->num_x / 2; x++) {
27 for (int y = 0; y < e->num_y / 2; y++) {
28
29 e->animation.dist = e->distance[x][y];
30 e->animation.angle = e->polar_theta[x][y] + 5 * e->move.noise_angle[0];
31 e->animation.z = 5;
32 e->animation.scale_x = 0.1;
33 e->animation.scale_y = 0.1;
34 e->animation.offset_z = 50 * e->move.linear[0];
35 e->animation.offset_x = 150 * e->move.directional[0];
36 e->animation.offset_y = 150 * e->move.directional[1];
37 float show1 = e->render_value(e->animation);
38
39 e->animation.dist = e->distance[x][y];
40 e->animation.angle = e->polar_theta[x][y] + 4 * e->move.noise_angle[1];
41 e->animation.z = 15;
42 e->animation.scale_x = 0.15;
43 e->animation.scale_y = 0.15;
44 e->animation.offset_z = 50 * e->move.linear[1];
45 e->animation.offset_x = 150 * e->move.directional[1];
46 e->animation.offset_y = 150 * e->move.directional[2];
47 float show2 = e->render_value(e->animation);
48
49 e->animation.dist = e->distance[x][y];
50 e->animation.angle = e->polar_theta[x][y] + 5 * e->move.noise_angle[2];
51 e->animation.z = 25;
52 e->animation.scale_x = 0.1;
53 e->animation.scale_y = 0.1;
54 e->animation.offset_z = 50 * e->move.linear[2];
55 e->animation.offset_x = 150 * e->move.directional[2];
56 e->animation.offset_y = 150 * e->move.directional[3];
57 float show3 = e->render_value(e->animation);
58
59 e->animation.dist = e->distance[x][y];
60 e->animation.angle = e->polar_theta[x][y] + 5 * e->move.noise_angle[3];
61 e->animation.z = 35;
62 e->animation.scale_x = 0.15;
63 e->animation.scale_y = 0.15;
64 e->animation.offset_z = 50 * e->move.linear[3];
65 e->animation.offset_x = 150 * e->move.directional[3];
66 e->animation.offset_y = 150 * e->move.directional[4];
67 float show4 = e->render_value(e->animation);
68
69 e->animation.dist = e->distance[x][y];
70 e->animation.angle = e->polar_theta[x][y] + 5 * e->move.noise_angle[4];
71 e->animation.z = 45;
72 e->animation.scale_x = 0.2;
73 e->animation.scale_y = 0.2;
74 e->animation.offset_z = 50 * e->move.linear[4];
75 e->animation.offset_x = 150 * e->move.directional[4];
76 e->animation.offset_y = 150 * e->move.directional[5];
77 float show5 = e->render_value(e->animation);
78
79 e->pixel.red = show1 + show2;
80 e->pixel.green = show3 + show4;
81 e->pixel.blue = show5;
82
83 e->pixel = e->rgb_sanity_check(e->pixel);
84 e->setPixelColorInternal(x, y, e->pixel);
85
86 e->setPixelColorInternal((e->num_x - 1) - x, y, e->pixel);
87 e->setPixelColorInternal((e->num_x - 1) - x, (e->num_y - 1) - y, e->pixel);
88 e->setPixelColorInternal(x, (e->num_y - 1) - y, e->pixel);
89 }
90 }
91}
92
93
94// ============================================================================
95// Fixed-Point Implementation of SpiralMatrix1
96// ============================================================================
97
99 auto *e = ctx.mEngine.get();
100 e->get_ready();
101 mState.ensureCache(e);
102 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
103 const fl::u8 *perm = PERLIN_NOISE;
104
105 e->timings.master_speed = 0.02;
106 e->timings.ratio[0] = 0.0025;
107 e->timings.ratio[1] = 0.0027;
108 e->timings.ratio[2] = 0.0031;
109 e->timings.ratio[3] = 0.0033;
110 e->timings.ratio[4] = 0.0036;
111 e->timings.ratio[5] = 0.0039;
112
113 e->calculate_oscillators(e->timings);
114
115 for (int x = 0; x < e->num_x / 2; x++) {
116 for (int y = 0; y < e->num_y / 2; y++) {
117
118 e->animation.dist = e->distance[x][y];
119 e->animation.angle = e->polar_theta[x][y] + 5 * e->move.noise_angle[0];
120 e->animation.z = 5;
121 e->animation.scale_x = 0.1;
122 e->animation.scale_y = 0.1;
123 e->animation.offset_z = 50 * e->move.linear[0];
124 e->animation.offset_x = 150 * e->move.directional[0];
125 e->animation.offset_y = 150 * e->move.directional[1];
126 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
127
128 e->animation.dist = e->distance[x][y];
129 e->animation.angle = e->polar_theta[x][y] + 4 * e->move.noise_angle[1];
130 e->animation.z = 15;
131 e->animation.scale_x = 0.15;
132 e->animation.scale_y = 0.15;
133 e->animation.offset_z = 50 * e->move.linear[1];
134 e->animation.offset_x = 150 * e->move.directional[1];
135 e->animation.offset_y = 150 * e->move.directional[2];
136 float 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] + 5 * e->move.noise_angle[2];
140 e->animation.z = 25;
141 e->animation.scale_x = 0.1;
142 e->animation.scale_y = 0.1;
143 e->animation.offset_z = 50 * e->move.linear[2];
144 e->animation.offset_x = 150 * e->move.directional[2];
145 e->animation.offset_y = 150 * e->move.directional[3];
146 float 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] + 5 * e->move.noise_angle[3];
150 e->animation.z = 35;
151 e->animation.scale_x = 0.15;
152 e->animation.scale_y = 0.15;
153 e->animation.offset_z = 50 * e->move.linear[3];
154 e->animation.offset_x = 150 * e->move.directional[3];
155 e->animation.offset_y = 150 * e->move.directional[4];
156 float show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
157
158 e->animation.dist = e->distance[x][y];
159 e->animation.angle = e->polar_theta[x][y] + 5 * e->move.noise_angle[4];
160 e->animation.z = 45;
161 e->animation.scale_x = 0.2;
162 e->animation.scale_y = 0.2;
163 e->animation.offset_z = 50 * e->move.linear[4];
164 e->animation.offset_x = 150 * e->move.directional[4];
165 e->animation.offset_y = 150 * e->move.directional[5];
166 float show5 = render_value_fp_from_float(e->animation, fade_lut, perm);
167
168 e->pixel.red = show1 + show2;
169 e->pixel.green = show3 + show4;
170 e->pixel.blue = show5;
171
172 e->pixel = e->rgb_sanity_check(e->pixel);
173 e->setPixelColorInternal(x, y, e->pixel);
174
175 e->setPixelColorInternal((e->num_x - 1) - x, y, e->pixel);
176 e->setPixelColorInternal((e->num_x - 1) - x, (e->num_y - 1) - y, e->pixel);
177 e->setPixelColorInternal(x, (e->num_y - 1) - y, e->pixel);
178 }
179 }
180}
181
182} // namespace fl
183
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