FastLED 3.10.8
Loading...
Searching...
No Matches
module_experiment5.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.031;
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.33;
21 e->timings.ratio[4] = 0.036;
22
23 e->calculate_oscillators(e->timings);
24
25 for (int x = 0; x < e->num_x; x++) {
26 for (int y = 0; y < e->num_y; y++) {
27
28 float s = 1.5;
29
30 e->animation.dist = e->distance[x][y] +
31 fl::sinf(0.5 * e->distance[x][y] - e->move.radial[3]);
32 e->animation.angle = e->polar_theta[x][y];
33 e->animation.z = 5;
34 e->animation.scale_x = 0.1 * s;
35 e->animation.scale_y = 0.1 * s;
36 e->animation.offset_z = 0.1 * e->move.linear[0];
37 e->animation.offset_y = -20 * e->move.linear[0];
38 e->animation.offset_x = 10;
39 e->animation.low_limit = 0;
40 e->show1 = e->render_value(e->animation);
41
42 e->pixel.red = e->show1;
43 e->pixel.green = 0;
44 e->pixel.blue = 0;
45
46 e->pixel = e->rgb_sanity_check(e->pixel);
47
48 e->setPixelColorInternal(x, y, e->pixel);
49 }
50 }
51}
52
53
54// ============================================================================
55// Fixed-Point Implementation of Module_Experiment5
56// ============================================================================
57
59 auto *e = ctx.mEngine.get();
60 e->get_ready();
61 mState.ensureCache(e);
62 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
63 const fl::u8 *perm = PERLIN_NOISE;
64
65 e->timings.master_speed = 0.031;
66 e->timings.ratio[0] = 0.0025;
67 e->timings.ratio[1] = 0.0027;
68 e->timings.ratio[2] = 0.029;
69 e->timings.ratio[3] = 0.33;
70 e->timings.ratio[4] = 0.036;
71
72 e->calculate_oscillators(e->timings);
73
74 for (int x = 0; x < e->num_x; x++) {
75 for (int y = 0; y < e->num_y; y++) {
76
77 float s = 1.5;
78
79 e->animation.dist = e->distance[x][y] +
80 fl::sinf(0.5 * e->distance[x][y] - e->move.radial[3]);
81 e->animation.angle = e->polar_theta[x][y];
82 e->animation.z = 5;
83 e->animation.scale_x = 0.1 * s;
84 e->animation.scale_y = 0.1 * s;
85 e->animation.offset_z = 0.1 * e->move.linear[0];
86 e->animation.offset_y = -20 * e->move.linear[0];
87 e->animation.offset_x = 10;
88 e->animation.low_limit = 0;
89 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
90
91 e->pixel.red = e->show1;
92 e->pixel.green = 0;
93 e->pixel.blue = 0;
94
95 e->pixel = e->rgb_sanity_check(e->pixel);
96
97 e->setPixelColorInternal(x, y, e->pixel);
98 }
99 }
100}
101
102} // namespace fl
103
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
float sinf(float value) FL_NO_EXCEPT
Definition math.h:360
Base definition for an LED controller.
Definition crgb.hpp:179