FastLED 3.10.8
Loading...
Searching...
No Matches
module_experiment4.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.031;
17 e->timings.ratio[0] = 0.0025;
18 e->timings.ratio[1] = 0.0027;
19 e->timings.ratio[2] = 0.029;
20 e->timings.ratio[3] = 0.033;
21 e->timings.ratio[4] = 0.036;
22
23 e->calculate_oscillators(e->timings);
24
25 for (int x = 0; x < e->num_x; x++) {
26 for (int y = 0; y < e->num_y; y++) {
27
28 float s = 0.8;
29
30 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) * 0.7;
31 e->animation.angle = e->polar_theta[x][y];
32 e->animation.z = 5;
33 e->animation.scale_x = 0.004 * s;
34 e->animation.scale_y = 0.003 * s;
35 e->animation.offset_z = 0.1 * e->move.linear[2];
36 e->animation.offset_y = -20 * e->move.linear[2];
37 e->animation.offset_x = 10;
38 e->animation.low_limit = 0;
39 e->show1 = e->render_value(e->animation);
40
41 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) * 0.8;
42 e->animation.angle = e->polar_theta[x][y];
43 e->animation.z = 50;
44 e->animation.scale_x = 0.004 * s;
45 e->animation.scale_y = 0.003 * s;
46 e->animation.offset_z = 0.1 * e->move.linear[3];
47 e->animation.offset_y = -20 * e->move.linear[3];
48 e->animation.offset_x = 100;
49 e->animation.low_limit = 0;
50 e->show2 = e->render_value(e->animation);
51
52 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) * 0.9;
53 e->animation.angle = e->polar_theta[x][y];
54 e->animation.z = 5000;
55 e->animation.scale_x = 0.004 * s;
56 e->animation.scale_y = 0.003 * s;
57 e->animation.offset_z = 0.1 * e->move.linear[4];
58 e->animation.offset_y = -20 * e->move.linear[4];
59 e->animation.offset_x = 1000;
60 e->animation.low_limit = 0;
61 e->show3 = e->render_value(e->animation);
62
63 e->pixel.red = e->show1 - e->show2 - e->show3;
64 e->pixel.blue = e->show2 - e->show1 - e->show3;
65 e->pixel.green = e->show3 - e->show1 - e->show2;
66
67 e->pixel = e->rgb_sanity_check(e->pixel);
68
69 e->setPixelColorInternal(x, y, e->pixel);
70 }
71 }
72}
73
74
75// ============================================================================
76// Fixed-Point Implementation of Module_Experiment4
77// ============================================================================
78
80 auto *e = ctx.mEngine.get();
81 e->get_ready();
82 mState.ensureCache(e);
83 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
84 const fl::u8 *perm = PERLIN_NOISE;
85
86 e->timings.master_speed = 0.031;
87 e->timings.ratio[0] = 0.0025;
88 e->timings.ratio[1] = 0.0027;
89 e->timings.ratio[2] = 0.029;
90 e->timings.ratio[3] = 0.033;
91 e->timings.ratio[4] = 0.036;
92
93 e->calculate_oscillators(e->timings);
94
95 for (int x = 0; x < e->num_x; x++) {
96 for (int y = 0; y < e->num_y; y++) {
97
98 float s = 0.8;
99
100 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) * 0.7;
101 e->animation.angle = e->polar_theta[x][y];
102 e->animation.z = 5;
103 e->animation.scale_x = 0.004 * s;
104 e->animation.scale_y = 0.003 * s;
105 e->animation.offset_z = 0.1 * e->move.linear[2];
106 e->animation.offset_y = -20 * e->move.linear[2];
107 e->animation.offset_x = 10;
108 e->animation.low_limit = 0;
109 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
110
111 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) * 0.8;
112 e->animation.angle = e->polar_theta[x][y];
113 e->animation.z = 50;
114 e->animation.scale_x = 0.004 * s;
115 e->animation.scale_y = 0.003 * s;
116 e->animation.offset_z = 0.1 * e->move.linear[3];
117 e->animation.offset_y = -20 * e->move.linear[3];
118 e->animation.offset_x = 100;
119 e->animation.low_limit = 0;
120 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
121
122 e->animation.dist = (e->distance[x][y] * e->distance[x][y]) * 0.9;
123 e->animation.angle = e->polar_theta[x][y];
124 e->animation.z = 5000;
125 e->animation.scale_x = 0.004 * s;
126 e->animation.scale_y = 0.003 * s;
127 e->animation.offset_z = 0.1 * e->move.linear[4];
128 e->animation.offset_y = -20 * e->move.linear[4];
129 e->animation.offset_x = 1000;
130 e->animation.low_limit = 0;
131 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
132
133 e->pixel.red = e->show1 - e->show2 - e->show3;
134 e->pixel.blue = e->show2 - e->show1 - e->show3;
135 e->pixel.green = e->show3 - e->show1 - e->show2;
136
137 e->pixel = e->rgb_sanity_check(e->pixel);
138
139 e->setPixelColorInternal(x, y, e->pixel);
140 }
141 }
142}
143
144} // namespace fl
145
void draw(Context &ctx) FL_NO_EXCEPT override
void draw(Context &ctx) FL_NO_EXCEPT override
#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