FastLED 3.10.8
Loading...
Searching...
No Matches
big_caleido.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.02;
17 e->timings.ratio[0] = 0.0025;
18 e->timings.ratio[1] = 0.0027;
19 e->timings.ratio[2] = 0.0031;
20 e->timings.ratio[3] = 0.0033;
21 e->timings.ratio[4] = 0.0036;
22 e->timings.ratio[5] = 0.0039;
23
24 e->calculate_oscillators(e->timings);
25
26 for (int x = 0; x < e->num_x; x++) {
27 for (int y = 0; y < e->num_y; y++) {
28 e->animation.dist = e->distance[x][y];
29 e->animation.angle = 5 * e->polar_theta[x][y] +
30 5 * e->move.noise_angle[0] +
31 e->animation.dist * 0.1;
32 e->animation.z = 5;
33 e->animation.scale_x = 0.05;
34 e->animation.scale_y = 0.05;
35 e->animation.offset_z = 50 * e->move.linear[0];
36 e->animation.offset_x = 50 * e->move.noise_angle[0];
37 e->animation.offset_y = 50 * e->move.noise_angle[1];
38 float show1 = e->render_value(e->animation);
39
40 e->animation.angle = 6 * e->polar_theta[x][y] +
41 5 * e->move.noise_angle[1] +
42 e->animation.dist * 0.15;
43 e->animation.z = 5;
44 e->animation.scale_x = 0.05;
45 e->animation.scale_y = 0.05;
46 e->animation.offset_z = 50 * e->move.linear[1];
47 e->animation.offset_x = 50 * e->move.noise_angle[1];
48 e->animation.offset_y = 50 * e->move.noise_angle[2];
49 float show2 = e->render_value(e->animation);
50
51 e->animation.angle = 5;
52 e->animation.z = 5;
53 e->animation.scale_x = 0.10;
54 e->animation.scale_y = 0.10;
55 e->animation.offset_z = 10 * e->move.linear[2];
56 e->animation.offset_x = 10 * e->move.noise_angle[2];
57 e->animation.offset_y = 10 * e->move.noise_angle[3];
58 float show3 = e->render_value(e->animation);
59
60 e->animation.angle = 15;
61 e->animation.z = 15;
62 e->animation.scale_x = 0.10;
63 e->animation.scale_y = 0.10;
64 e->animation.offset_z = 10 * e->move.linear[3];
65 e->animation.offset_x = 10 * e->move.noise_angle[3];
66 e->animation.offset_y = 10 * e->move.noise_angle[4];
67 float show4 = e->render_value(e->animation);
68
69 e->animation.angle = 2;
70 e->animation.z = 15;
71 e->animation.scale_x = 0.15;
72 e->animation.scale_y = 0.15;
73 e->animation.offset_z = 10 * e->move.linear[4];
74 e->animation.offset_x = 10 * e->move.noise_angle[4];
75 e->animation.offset_y = 10 * e->move.noise_angle[5];
76 float show5 = e->render_value(e->animation);
77
78 e->pixel.red = show1 - show4;
79 e->pixel.green = show2 - show5;
80 e->pixel.blue = show3 - show2 + show1;
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 Big_Caleido
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->timings.master_speed = 0.02;
101 e->timings.ratio[0] = 0.0025;
102 e->timings.ratio[1] = 0.0027;
103 e->timings.ratio[2] = 0.0031;
104 e->timings.ratio[3] = 0.0033;
105 e->timings.ratio[4] = 0.0036;
106 e->timings.ratio[5] = 0.0039;
107
108 e->calculate_oscillators(e->timings);
109
110 for (int x = 0; x < e->num_x; x++) {
111 for (int y = 0; y < e->num_y; y++) {
112 e->animation.dist = e->distance[x][y];
113 e->animation.angle = 5 * e->polar_theta[x][y] +
114 5 * e->move.noise_angle[0] +
115 e->animation.dist * 0.1;
116 e->animation.z = 5;
117 e->animation.scale_x = 0.05;
118 e->animation.scale_y = 0.05;
119 e->animation.offset_z = 50 * e->move.linear[0];
120 e->animation.offset_x = 50 * e->move.noise_angle[0];
121 e->animation.offset_y = 50 * e->move.noise_angle[1];
122 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
123
124 e->animation.angle = 6 * e->polar_theta[x][y] +
125 5 * e->move.noise_angle[1] +
126 e->animation.dist * 0.15;
127 e->animation.z = 5;
128 e->animation.scale_x = 0.05;
129 e->animation.scale_y = 0.05;
130 e->animation.offset_z = 50 * e->move.linear[1];
131 e->animation.offset_x = 50 * e->move.noise_angle[1];
132 e->animation.offset_y = 50 * e->move.noise_angle[2];
133 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
134
135 e->animation.angle = 5;
136 e->animation.z = 5;
137 e->animation.scale_x = 0.10;
138 e->animation.scale_y = 0.10;
139 e->animation.offset_z = 10 * e->move.linear[2];
140 e->animation.offset_x = 10 * e->move.noise_angle[2];
141 e->animation.offset_y = 10 * e->move.noise_angle[3];
142 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
143
144 e->animation.angle = 15;
145 e->animation.z = 15;
146 e->animation.scale_x = 0.10;
147 e->animation.scale_y = 0.10;
148 e->animation.offset_z = 10 * e->move.linear[3];
149 e->animation.offset_x = 10 * e->move.noise_angle[3];
150 e->animation.offset_y = 10 * e->move.noise_angle[4];
151 float show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
152
153 e->animation.angle = 2;
154 e->animation.z = 15;
155 e->animation.scale_x = 0.15;
156 e->animation.scale_y = 0.15;
157 e->animation.offset_z = 10 * e->move.linear[4];
158 e->animation.offset_x = 10 * e->move.noise_angle[4];
159 e->animation.offset_y = 10 * e->move.noise_angle[5];
160 float show5 = render_value_fp_from_float(e->animation, fade_lut, perm);
161
162 e->pixel.red = show1 - show4;
163 e->pixel.green = show2 - show5;
164 e->pixel.blue = show3 - show2 + show1;
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
void draw(Context &ctx) FL_NO_EXCEPT override
FPVizState mState
Definition big_caleido.h:23
void draw(Context &ctx) FL_NO_EXCEPT override
T * assume_aligned(T *ptr) FL_NO_EXCEPT
Definition s16x16x4.h:126
unsigned char u8
Definition s16x16x4.h:132
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.
#define FL_OPTIMIZATION_LEVEL_O3_BEGIN
#define FL_FAST_MATH_BEGIN
#define FL_FAST_MATH_END
#define FL_OPTIMIZATION_LEVEL_O3_END