FastLED 3.10.8
Loading...
Searching...
No Matches
distance_experiment.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.01;
17 e->timings.ratio[0] = 0.2;
18 e->timings.ratio[1] = 0.13;
19 e->timings.ratio[2] = 0.012;
20
21 e->timings.offset[1] = 100;
22 e->timings.offset[2] = 200;
23 e->timings.offset[3] = 300;
24
25 e->calculate_oscillators(e->timings);
26
27 for (int x = 0; x < e->num_x; x++) {
28 for (int y = 0; y < e->num_y; y++) {
29 e->animation.dist = fl::powf(e->distance[x][y], 0.5f);
30 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
31 e->animation.scale_x = 0.07;
32 e->animation.scale_y = 0.07;
33 e->animation.scale_z = 0.1;
34 e->animation.offset_y = e->move.linear[0];
35 e->animation.offset_x = 0;
36 e->animation.offset_z = 0;
37 e->animation.z = 0;
38 float show1 = e->render_value(e->animation);
39
40 e->animation.dist = fl::powf(e->distance[x][y], 0.6f);
41 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[2];
42 e->animation.scale_x = 0.07;
43 e->animation.scale_y = 0.07;
44 e->animation.scale_z = 0.1;
45 e->animation.offset_y = e->move.linear[1];
46 e->animation.offset_x = 0;
47 e->animation.offset_z = 0;
48 e->animation.z = 0;
49 float show2 = e->render_value(e->animation);
50
51 e->pixel.red = show1 + show2;
52 e->pixel.green = show2;
53 e->pixel.blue = 0;
54
55 e->pixel = e->rgb_sanity_check(e->pixel);
56 e->setPixelColorInternal(x, y, e->pixel);
57 }
58 }
59}
60
61
62// ============================================================================
63// Fixed-Point Implementation of Distance_Experiment
64// ============================================================================
65
67 auto *e = ctx.mEngine.get();
68 e->get_ready();
69 mState.ensureCache(e);
70 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
71 const fl::u8 *perm = PERLIN_NOISE;
72
73 e->timings.master_speed = 0.01;
74 e->timings.ratio[0] = 0.2;
75 e->timings.ratio[1] = 0.13;
76 e->timings.ratio[2] = 0.012;
77
78 e->timings.offset[1] = 100;
79 e->timings.offset[2] = 200;
80 e->timings.offset[3] = 300;
81
82 e->calculate_oscillators(e->timings);
83
84 for (int x = 0; x < e->num_x; x++) {
85 for (int y = 0; y < e->num_y; y++) {
86 e->animation.dist = fl::powf(e->distance[x][y], 0.5f);
87 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
88 e->animation.scale_x = 0.07;
89 e->animation.scale_y = 0.07;
90 e->animation.scale_z = 0.1;
91 e->animation.offset_y = e->move.linear[0];
92 e->animation.offset_x = 0;
93 e->animation.offset_z = 0;
94 e->animation.z = 0;
95 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
96
97 e->animation.dist = fl::powf(e->distance[x][y], 0.6f);
98 e->animation.angle = e->polar_theta[x][y] + e->move.noise_angle[2];
99 e->animation.scale_x = 0.07;
100 e->animation.scale_y = 0.07;
101 e->animation.scale_z = 0.1;
102 e->animation.offset_y = e->move.linear[1];
103 e->animation.offset_x = 0;
104 e->animation.offset_z = 0;
105 e->animation.z = 0;
106 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
107
108 e->pixel.red = show1 + show2;
109 e->pixel.green = show2;
110 e->pixel.blue = 0;
111
112 e->pixel = e->rgb_sanity_check(e->pixel);
113 e->setPixelColorInternal(x, y, e->pixel);
114 }
115 }
116}
117
118} // namespace fl
119
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 powf(float base, float exponent) FL_NO_EXCEPT
Definition math.h:444
Base definition for an LED controller.
Definition crgb.hpp:179