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