FastLED 3.9.15
Loading...
Searching...
No Matches
spiral_matrix2.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.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] * (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->pixel.red = show1;
59 e->pixel.green = show2;
60 e->pixel.blue = show3;
61
62 e->pixel = e->rgb_sanity_check(e->pixel);
63
64 e->setPixelColorInternal(x, y, e->pixel);
65 }
66 }
67}
68
69
70// ============================================================================
71// Fixed-Point Implementation of SpiralMatrix2
72// ============================================================================
73
75 auto *e = ctx.mEngine.get();
76 e->get_ready();
77 mState.ensureCache(e);
78 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
79 const fl::u8 *perm = PERLIN_NOISE;
80
81 e->timings.master_speed = 0.03;
82 e->timings.ratio[0] = 0.025;
83 e->timings.ratio[1] = 0.027;
84 e->timings.ratio[2] = 0.031;
85 e->timings.ratio[3] = 0.0033;
86 e->timings.ratio[4] = 0.0036;
87 e->timings.ratio[5] = 0.0039;
88
89 e->calculate_oscillators(e->timings);
90
91 for (int x = 0; x < e->num_x; x++) {
92 for (int y = 0; y < e->num_y; y++) {
93
94 e->animation.dist = e->distance[x][y] * (e->move.directional[0]);
95 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
96 e->animation.z = 5;
97 e->animation.scale_x = 0.09;
98 e->animation.scale_y = 0.09;
99 e->animation.offset_z = 5 * e->move.linear[0];
100 e->animation.offset_x = 0;
101 e->animation.offset_y = 0;
102 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
103
104 e->animation.dist = e->distance[x][y] * e->move.directional[1];
105 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
106 e->animation.z = 50;
107 e->animation.scale_x = 0.07;
108 e->animation.scale_y = 0.07;
109 e->animation.offset_z = 5 * e->move.linear[1];
110 e->animation.offset_x = 0;
111 e->animation.offset_y = 0;
112 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
113
114 e->animation.dist = e->distance[x][y] * e->move.directional[2];
115 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2];
116 e->animation.z = 500;
117 e->animation.scale_x = 0.05;
118 e->animation.scale_y = 0.05;
119 e->animation.offset_z = 5 * e->move.linear[2];
120 e->animation.offset_x = 0;
121 e->animation.offset_y = 0;
122 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
123
124 e->pixel.red = show1;
125 e->pixel.green = show2;
126 e->pixel.blue = show3;
127
128 e->pixel = e->rgb_sanity_check(e->pixel);
129
130 e->setPixelColorInternal(x, y, e->pixel);
131 }
132 }
133}
134
135} // namespace fl
136
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