FastLED 3.10.8
Loading...
Searching...
No Matches
zoom2.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->run_default_oscillators();
17 e->timings.master_speed = 0.003;
18 e->calculate_oscillators(e->timings);
19
20 for (int x = 0; x < e->num_x; x++) {
21 for (int y = 0; y < e->num_y; y++) {
22 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) / 2;
23 e->animation.angle = e->polar_theta[x][y];
24
25 e->animation.scale_x = 0.005;
26 e->animation.scale_y = 0.005;
27
28 e->animation.offset_y = -10 * e->move.linear[0];
29 e->animation.offset_x = 0;
30 e->animation.offset_z = 0.1 * e->move.linear[0];
31
32 e->animation.z = 0;
33 e->animation.low_limit = 0;
34 float show1 = e->render_value(e->animation);
35
36 e->pixel.red = show1;
37 e->pixel.green = 0;
38 e->pixel.blue = 40 - show1;
39
40 e->pixel = e->rgb_sanity_check(e->pixel);
41 e->setPixelColorInternal(x, y, e->pixel);
42 }
43 }
44}
45
46
47// ============================================================================
48// Fixed-Point Implementation of Zoom2
49// ============================================================================
50
52 auto *e = ctx.mEngine.get();
53 e->get_ready();
54 mState.ensureCache(e);
55 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
56 const fl::u8 *perm = PERLIN_NOISE;
57
58 e->run_default_oscillators();
59 e->timings.master_speed = 0.003;
60 e->calculate_oscillators(e->timings);
61
62 for (int x = 0; x < e->num_x; x++) {
63 for (int y = 0; y < e->num_y; y++) {
64 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) / 2;
65 e->animation.angle = e->polar_theta[x][y];
66
67 e->animation.scale_x = 0.005;
68 e->animation.scale_y = 0.005;
69
70 e->animation.offset_y = -10 * e->move.linear[0];
71 e->animation.offset_x = 0;
72 e->animation.offset_z = 0.1 * e->move.linear[0];
73
74 e->animation.z = 0;
75 e->animation.low_limit = 0;
76 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
77
78 e->pixel.red = show1;
79 e->pixel.green = 0;
80 e->pixel.blue = 40 - show1;
81
82 e->pixel = e->rgb_sanity_check(e->pixel);
83 e->setPixelColorInternal(x, y, e->pixel);
84 }
85 }
86}
87
88} // namespace fl
89
void draw(Context &ctx) FL_NO_EXCEPT override
Definition zoom2.cpp.hpp:51
FPVizState mState
Definition zoom2.h:23
void draw(Context &ctx) FL_NO_EXCEPT override
Definition zoom2.cpp.hpp:12
#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