FastLED 3.10.8
Loading...
Searching...
No Matches
polar_waves.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.5;
17 e->timings.ratio[0] = 0.0025;
18 e->timings.ratio[1] = 0.0027;
19 e->timings.ratio[2] = 0.0031;
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 e->animation.dist = (e->distance[x][y]);
26 e->animation.angle =
27 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[0];
28 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[0];
29 e->animation.scale_x = 0.15;
30 e->animation.scale_y = 0.15;
31 e->animation.offset_x = e->move.linear[0];
32
33 float show1 = e->render_value(e->animation);
34 e->animation.angle =
35 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[1];
36 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[1];
37 e->animation.offset_x = e->move.linear[1];
38
39 float show2 = e->render_value(e->animation);
40 e->animation.angle =
41 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[2];
42 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[2];
43 e->animation.offset_x = e->move.linear[2];
44
45 float show3 = e->render_value(e->animation);
46
47 float radius = e->radial_filter_radius;
48 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
49
50 e->pixel.red = radial * show1;
51 e->pixel.green = radial * show2;
52 e->pixel.blue = radial * show3;
53
54 e->pixel = e->rgb_sanity_check(e->pixel);
55 e->setPixelColorInternal(x, y, e->pixel);
56 }
57 }
58}
59
60
61// ============================================================================
62// Fixed-Point Implementation of Polar_Waves
63// ============================================================================
64
66 auto *e = ctx.mEngine.get();
67 e->get_ready();
68 mState.ensureCache(e);
69 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
70 const fl::u8 *perm = PERLIN_NOISE;
71
72 e->timings.master_speed = 0.5;
73 e->timings.ratio[0] = 0.0025;
74 e->timings.ratio[1] = 0.0027;
75 e->timings.ratio[2] = 0.0031;
76
77 e->calculate_oscillators(e->timings);
78
79 for (int x = 0; x < e->num_x; x++) {
80 for (int y = 0; y < e->num_y; y++) {
81 e->animation.dist = (e->distance[x][y]);
82 e->animation.angle =
83 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[0];
84 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[0];
85 e->animation.scale_x = 0.15;
86 e->animation.scale_y = 0.15;
87 e->animation.offset_x = e->move.linear[0];
88
89 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
90 e->animation.angle =
91 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[1];
92 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[1];
93 e->animation.offset_x = e->move.linear[1];
94
95 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
96 e->animation.angle =
97 e->polar_theta[x][y] - e->animation.dist * 0.1 + e->move.radial[2];
98 e->animation.z = (e->animation.dist * 1.5) - 10 * e->move.linear[2];
99 e->animation.offset_x = e->move.linear[2];
100
101 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
102
103 float radius = e->radial_filter_radius;
104 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
105
106 e->pixel.red = radial * show1;
107 e->pixel.green = radial * show2;
108 e->pixel.blue = radial * show3;
109
110 e->pixel = e->rgb_sanity_check(e->pixel);
111 e->setPixelColorInternal(x, y, e->pixel);
112 }
113 }
114}
115
116} // namespace fl
117
FPVizState mState
Definition polar_waves.h:23
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