FastLED 3.10.8
Loading...
Searching...
No Matches
yves.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->a = fl::micros();
17
18 e->timings.master_speed = 0.001;
19 e->timings.ratio[0] = 3;
20 e->timings.ratio[1] = 2;
21 e->timings.ratio[2] = 1;
22 e->timings.ratio[3] = 0.13;
23 e->timings.ratio[4] = 0.15;
24 e->timings.ratio[5] = 0.03;
25 e->timings.ratio[6] = 0.025;
26 e->timings.offset[0] = 0;
27 e->timings.offset[1] = 100;
28 e->timings.offset[2] = 200;
29 e->timings.offset[3] = 300;
30 e->timings.offset[4] = 400;
31 e->timings.offset[5] = 500;
32 e->timings.offset[6] = 600;
33
34 e->calculate_oscillators(e->timings);
35
36 for (int x = 0; x < e->num_x; x++) {
37 for (int y = 0; y < e->num_y; y++) {
38 e->animation.dist = e->distance[x][y];
39 e->animation.angle =
40 e->polar_theta[x][y] + 2 * PI + e->move.noise_angle[5];
41 e->animation.scale_x = 0.08;
42 e->animation.scale_y = 0.08;
43 e->animation.scale_z = 0.08;
44 e->animation.offset_y = -e->move.linear[0];
45 e->animation.offset_x = 0;
46 e->animation.offset_z = 0;
47 e->animation.z = 0;
48 float show1 = e->render_value(e->animation);
49
50 e->animation.dist = e->distance[x][y];
51 e->animation.angle =
52 e->polar_theta[x][y] + 2 * PI + e->move.noise_angle[6];
53 ;
54 e->animation.scale_x = 0.08;
55 e->animation.scale_y = 0.08;
56 e->animation.scale_z = 0.08;
57 e->animation.offset_y = -e->move.linear[1];
58 e->animation.offset_x = 0;
59 e->animation.offset_z = 0;
60 e->animation.z = 0;
61 float show2 = e->render_value(e->animation);
62
63 e->animation.angle = e->polar_theta[x][y] + show1 / 100 +
64 e->move.noise_angle[3] + e->move.noise_angle[4];
65 e->animation.dist = e->distance[x][y] + show2 / 50;
66 e->animation.offset_y = -e->move.linear[2];
67
68 e->animation.offset_y += show1 / 100;
69 e->animation.offset_x += show2 / 100;
70
71 float show3 = e->render_value(e->animation);
72
73 e->animation.offset_y = 0;
74 e->animation.offset_x = 0;
75
76 float show4 = e->render_value(e->animation);
77
78 e->pixel.red = show3;
79 e->pixel.green = show3 * show4 / 255;
80 e->pixel.blue = 0;
81
82 e->pixel = e->rgb_sanity_check(e->pixel);
83 e->setPixelColorInternal(x, y, e->pixel);
84 }
85 }
86}
87
88
89// ============================================================================
90// Fixed-Point Implementation of Yves
91// ============================================================================
92
94 auto *e = ctx.mEngine.get();
95 e->get_ready();
96 mState.ensureCache(e);
97 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
98 const fl::u8 *perm = PERLIN_NOISE;
99
100 e->a = fl::micros();
101
102 e->timings.master_speed = 0.001;
103 e->timings.ratio[0] = 3;
104 e->timings.ratio[1] = 2;
105 e->timings.ratio[2] = 1;
106 e->timings.ratio[3] = 0.13;
107 e->timings.ratio[4] = 0.15;
108 e->timings.ratio[5] = 0.03;
109 e->timings.ratio[6] = 0.025;
110 e->timings.offset[0] = 0;
111 e->timings.offset[1] = 100;
112 e->timings.offset[2] = 200;
113 e->timings.offset[3] = 300;
114 e->timings.offset[4] = 400;
115 e->timings.offset[5] = 500;
116 e->timings.offset[6] = 600;
117
118 e->calculate_oscillators(e->timings);
119
120 for (int x = 0; x < e->num_x; x++) {
121 for (int y = 0; y < e->num_y; y++) {
122 e->animation.dist = e->distance[x][y];
123 e->animation.angle =
124 e->polar_theta[x][y] + 2 * PI + e->move.noise_angle[5];
125 e->animation.scale_x = 0.08;
126 e->animation.scale_y = 0.08;
127 e->animation.scale_z = 0.08;
128 e->animation.offset_y = -e->move.linear[0];
129 e->animation.offset_x = 0;
130 e->animation.offset_z = 0;
131 e->animation.z = 0;
132 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
133
134 e->animation.dist = e->distance[x][y];
135 e->animation.angle =
136 e->polar_theta[x][y] + 2 * PI + e->move.noise_angle[6];
137 ;
138 e->animation.scale_x = 0.08;
139 e->animation.scale_y = 0.08;
140 e->animation.scale_z = 0.08;
141 e->animation.offset_y = -e->move.linear[1];
142 e->animation.offset_x = 0;
143 e->animation.offset_z = 0;
144 e->animation.z = 0;
145 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
146
147 e->animation.angle = e->polar_theta[x][y] + show1 / 100 +
148 e->move.noise_angle[3] + e->move.noise_angle[4];
149 e->animation.dist = e->distance[x][y] + show2 / 50;
150 e->animation.offset_y = -e->move.linear[2];
151
152 e->animation.offset_y += show1 / 100;
153 e->animation.offset_x += show2 / 100;
154
155 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
156
157 e->animation.offset_y = 0;
158 e->animation.offset_x = 0;
159
160 float show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
161
162 e->pixel.red = show3;
163 e->pixel.green = show3 * show4 / 255;
164 e->pixel.blue = 0;
165
166 e->pixel = e->rgb_sanity_check(e->pixel);
167 e->setPixelColorInternal(x, y, e->pixel);
168 }
169 }
170}
171
172} // namespace fl
173
#define PI
void draw(Context &ctx) FL_NO_EXCEPT override
Definition yves.cpp.hpp:93
FPVizState mState
Definition yves.h:23
void draw(Context &ctx) FL_NO_EXCEPT override
Definition yves.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
fl::u32 micros() FL_NO_EXCEPT
Universal microsecond timer - returns microseconds since system startup.
Base definition for an LED controller.
Definition crgb.hpp:179