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