FastLED 3.10.8
Loading...
Searching...
No Matches
module_experiment9.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.03;
17
18 float w = 0.3;
19
20 e->timings.ratio[0] = 0.1;
21 e->timings.ratio[1] = 0.011;
22 e->timings.ratio[2] = 0.013;
23 e->timings.ratio[3] = 0.33 * w;
24 e->timings.ratio[4] = 0.36 * w;
25 e->timings.ratio[5] = 0.38 * w;
26 e->timings.ratio[6] = 0.0003;
27
28 e->calculate_oscillators(e->timings);
29
30 for (int x = 0; x < e->num_x; x++) {
31 for (int y = 0; y < e->num_y; y++) {
32
33 e->animation.dist = e->distance[x][y];
34 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
35 e->animation.z = 5;
36 e->animation.scale_x = 0.001;
37 e->animation.scale_y = 0.1;
38 e->animation.scale_z = 0.1;
39 e->animation.offset_y = -10 * e->move.linear[0];
40 e->animation.offset_x = 20;
41 e->animation.offset_z = 10;
42 e->animation.low_limit = 0;
43 e->show1 = e->render_value(e->animation);
44
45 e->pixel.red = 10 * e->show1;
46 e->pixel.green = 0;
47 e->pixel.blue = 0;
48
49 e->pixel = e->rgb_sanity_check(e->pixel);
50
51 e->setPixelColorInternal(x, y, e->pixel);
52 }
53 }
54}
55
56
57// ============================================================================
58// Fixed-Point Implementation of Module_Experiment9
59// ============================================================================
60
62 auto *e = ctx.mEngine.get();
63 e->get_ready();
64 mState.ensureCache(e);
65 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
66 const fl::u8 *perm = PERLIN_NOISE;
67
68 e->timings.master_speed = 0.03;
69
70 float w = 0.3;
71
72 e->timings.ratio[0] = 0.1;
73 e->timings.ratio[1] = 0.011;
74 e->timings.ratio[2] = 0.013;
75 e->timings.ratio[3] = 0.33 * w;
76 e->timings.ratio[4] = 0.36 * w;
77 e->timings.ratio[5] = 0.38 * w;
78 e->timings.ratio[6] = 0.0003;
79
80 e->calculate_oscillators(e->timings);
81
82 for (int x = 0; x < e->num_x; x++) {
83 for (int y = 0; y < e->num_y; y++) {
84
85 e->animation.dist = e->distance[x][y];
86 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
87 e->animation.z = 5;
88 e->animation.scale_x = 0.001;
89 e->animation.scale_y = 0.1;
90 e->animation.scale_z = 0.1;
91 e->animation.offset_y = -10 * e->move.linear[0];
92 e->animation.offset_x = 20;
93 e->animation.offset_z = 10;
94 e->animation.low_limit = 0;
95 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
96
97 e->pixel.red = 10 * e->show1;
98 e->pixel.green = 0;
99 e->pixel.blue = 0;
100
101 e->pixel = e->rgb_sanity_check(e->pixel);
102
103 e->setPixelColorInternal(x, y, e->pixel);
104 }
105 }
106}
107
108} // namespace fl
109
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