FastLED 3.10.8
Loading...
Searching...
No Matches
hot_blob.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 e->run_default_oscillators(0.001);
16
17 for (int x = 0; x < e->num_x; x++) {
18 for (int y = 0; y < e->num_y; y++) {
19 e->animation.dist = e->distance[x][y];
20 e->animation.angle = e->polar_theta[x][y];
21
22 e->animation.scale_x = 0.07 + e->move.directional[0] * 0.002;
23 e->animation.scale_y = 0.07;
24
25 e->animation.offset_y = -e->move.linear[0];
26 e->animation.offset_x = 0;
27 e->animation.offset_z = 0;
28
29 e->animation.z = 0;
30 e->animation.low_limit = -1;
31 float show1 = e->render_value(e->animation);
32
33 e->animation.offset_y = -e->move.linear[1];
34 float show3 = e->render_value(e->animation);
35
36 e->animation.offset_x = show3 / 20;
37 e->animation.offset_y = -e->move.linear[0] / 2 + show1 / 70;
38 e->animation.low_limit = 0;
39 float show2 = e->render_value(e->animation);
40
41 e->animation.offset_x = show3 / 20;
42 e->animation.offset_y = -e->move.linear[0] / 2 + show1 / 70;
43 e->animation.z = 100;
44 float show4 = e->render_value(e->animation);
45
46 float radius = e->radial_filter_radius;
47 float radial = (radius - e->animation.dist) / e->animation.dist;
48
49 float linear = (y + 1) / (e->num_y - 1.f);
50
51 e->pixel.red = radial * show2;
52 e->pixel.green = linear * radial * 0.3 * (show2 - show4);
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 Hot_Blob
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 e->run_default_oscillators(0.001);
73
74 for (int x = 0; x < e->num_x; x++) {
75 for (int y = 0; y < e->num_y; y++) {
76 e->animation.dist = e->distance[x][y];
77 e->animation.angle = e->polar_theta[x][y];
78
79 e->animation.scale_x = 0.07 + e->move.directional[0] * 0.002;
80 e->animation.scale_y = 0.07;
81
82 e->animation.offset_y = -e->move.linear[0];
83 e->animation.offset_x = 0;
84 e->animation.offset_z = 0;
85
86 e->animation.z = 0;
87 e->animation.low_limit = -1;
88 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
89
90 e->animation.offset_y = -e->move.linear[1];
91 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
92
93 e->animation.offset_x = show3 / 20;
94 e->animation.offset_y = -e->move.linear[0] / 2 + show1 / 70;
95 e->animation.low_limit = 0;
96 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
97
98 e->animation.offset_x = show3 / 20;
99 e->animation.offset_y = -e->move.linear[0] / 2 + show1 / 70;
100 e->animation.z = 100;
101 float show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
102
103 float radius = e->radial_filter_radius;
104 float radial = (radius - e->animation.dist) / e->animation.dist;
105
106 float linear = (y + 1) / (e->num_y - 1.f);
107
108 e->pixel.red = radial * show2;
109 e->pixel.green = linear * radial * 0.3 * (show2 - show4);
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
FPVizState mState
Definition hot_blob.h:23
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