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