FastLED 3.10.8
Loading...
Searching...
No Matches
rings.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] = 1;
18 e->timings.ratio[1] = 1.1;
19 e->timings.ratio[2] = 1.2;
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.angle = 5;
30 e->animation.scale_x = 0.2;
31 e->animation.scale_y = 0.2;
32 e->animation.scale_z = 1;
33 e->animation.dist = e->distance[x][y];
34 e->animation.offset_y = -e->move.linear[0];
35 e->animation.offset_x = 0;
36 float show1 = e->render_value(e->animation);
37
38 e->animation.angle = 10;
39 e->animation.dist = e->distance[x][y];
40 e->animation.offset_y = -e->move.linear[1];
41 float show2 = e->render_value(e->animation);
42
43 e->animation.angle = 12;
44 e->animation.dist = e->distance[x][y];
45 e->animation.offset_y = -e->move.linear[2];
46 float show3 = e->render_value(e->animation);
47
48 e->pixel.red = show1;
49 e->pixel.green = show2 / 4;
50 e->pixel.blue = show3 / 4;
51
52 e->pixel = e->rgb_sanity_check(e->pixel);
53 e->setPixelColorInternal(x, y, e->pixel);
54 }
55 }
56}
57
58
59// ============================================================================
60// Fixed-Point Implementation of Rings
61// ============================================================================
62
64 auto *e = ctx.mEngine.get();
65 e->get_ready();
66 mState.ensureCache(e);
67 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
68 const fl::u8 *perm = PERLIN_NOISE;
69
70 e->timings.master_speed = 0.01;
71 e->timings.ratio[0] = 1;
72 e->timings.ratio[1] = 1.1;
73 e->timings.ratio[2] = 1.2;
74
75 e->timings.offset[1] = 100;
76 e->timings.offset[2] = 200;
77 e->timings.offset[3] = 300;
78
79 e->calculate_oscillators(e->timings);
80
81 for (int x = 0; x < e->num_x; x++) {
82 for (int y = 0; y < e->num_y; y++) {
83 e->animation.angle = 5;
84 e->animation.scale_x = 0.2;
85 e->animation.scale_y = 0.2;
86 e->animation.scale_z = 1;
87 e->animation.dist = e->distance[x][y];
88 e->animation.offset_y = -e->move.linear[0];
89 e->animation.offset_x = 0;
90 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
91
92 e->animation.angle = 10;
93 e->animation.dist = e->distance[x][y];
94 e->animation.offset_y = -e->move.linear[1];
95 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
96
97 e->animation.angle = 12;
98 e->animation.dist = e->distance[x][y];
99 e->animation.offset_y = -e->move.linear[2];
100 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
101
102 e->pixel.red = show1;
103 e->pixel.green = show2 / 4;
104 e->pixel.blue = show3 / 4;
105
106 e->pixel = e->rgb_sanity_check(e->pixel);
107 e->setPixelColorInternal(x, y, e->pixel);
108 }
109 }
110}
111
112} // namespace fl
113
void draw(Context &ctx) FL_NO_EXCEPT override
Definition rings.cpp.hpp:63
FPVizState mState
Definition rings.h:23
void draw(Context &ctx) FL_NO_EXCEPT override
Definition rings.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