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