FastLED 3.10.8
Loading...
Searching...
No Matches

◆ draw()

void fl::RGB_Blobs_FP::draw ( Context & ctx)
overridevirtual

Implements fl::IAnimartrix2Viz.

Definition at line 68 of file rgb_blobs.cpp.hpp.

68 {
69 auto *e = ctx.mEngine.get();
70 e->get_ready();
71 mState.ensureCache(e);
72 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
73 const fl::u8 *perm = PERLIN_NOISE;
74
75 e->timings.master_speed = 0.2;
76 e->timings.ratio[0] = 0.0025;
77 e->timings.ratio[1] = 0.0027;
78 e->timings.ratio[2] = 0.0031;
79 e->timings.ratio[3] = 0.0033;
80 e->timings.ratio[4] = 0.0036;
81 e->timings.ratio[5] = 0.0039;
82
83 e->calculate_oscillators(e->timings);
84
85 for (int x = 0; x < e->num_x; x++) {
86 for (int y = 0; y < e->num_y; y++) {
87 e->animation.dist = e->distance[x][y];
88 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0] +
89 e->move.noise_angle[0] + e->move.noise_angle[3];
90 e->animation.z = (fl::sqrtf(e->animation.dist));
91 e->animation.scale_x = 0.1;
92 e->animation.scale_y = 0.1;
93 e->animation.offset_z = 10;
94 e->animation.offset_x = 10 * e->move.linear[0];
95 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
96
97 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1] +
98 e->move.noise_angle[1] + e->move.noise_angle[4];
99 e->animation.offset_x = 11 * e->move.linear[1];
100 e->animation.offset_z = 100;
101 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
102
103 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2] +
104 e->move.noise_angle[2] + e->move.noise_angle[5];
105 e->animation.offset_x = 12 * e->move.linear[2];
106 e->animation.offset_z = 300;
107 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
108
109 float radius = e->radial_filter_radius;
110 float radial = (radius - e->distance[x][y]) / e->distance[x][y];
111
112 e->pixel.red = radial * show1;
113 e->pixel.green = radial * show2;
114 e->pixel.blue = radial * show3;
115
116 e->pixel = e->rgb_sanity_check(e->pixel);
117 e->setPixelColorInternal(x, y, e->pixel);
118 }
119 }
120}
FPVizState mState
Definition rgb_blobs.h:23
T * assume_aligned(T *ptr) FL_NO_EXCEPT
Definition s16x16x4.h:126
unsigned char u8
Definition stdint.h:131
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 sqrtf(float value) FL_NO_EXCEPT
Definition math.h:461

References fl::fl::assume_aligned(), fl::FL_NO_EXCEPT, mState, fl::render_value_fp_from_float(), fl::sqrtf(), fl::x, and fl::y.

+ Here is the call graph for this function: