FastLED 3.10.8
Loading...
Searching...
No Matches
spiral_matrix2.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.03;
17 e->timings.ratio[0] = 0.025;
18 e->timings.ratio[1] = 0.027;
19 e->timings.ratio[2] = 0.031;
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
29 e->animation.dist = e->distance[x][y] * (e->move.directional[0]);
30 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
31 e->animation.z = 5;
32 e->animation.scale_x = 0.09;
33 e->animation.scale_y = 0.09;
34 e->animation.offset_z = 5 * e->move.linear[0];
35 e->animation.offset_x = 0;
36 e->animation.offset_y = 0;
37 float show1 = e->render_value(e->animation);
38
39 e->animation.dist = e->distance[x][y] * e->move.directional[1];
40 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
41 e->animation.z = 50;
42 e->animation.scale_x = 0.07;
43 e->animation.scale_y = 0.07;
44 e->animation.offset_z = 5 * e->move.linear[1];
45 e->animation.offset_x = 0;
46 e->animation.offset_y = 0;
47 float show2 = e->render_value(e->animation);
48
49 e->animation.dist = e->distance[x][y] * e->move.directional[2];
50 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2];
51 e->animation.z = 500;
52 e->animation.scale_x = 0.05;
53 e->animation.scale_y = 0.05;
54 e->animation.offset_z = 5 * e->move.linear[2];
55 e->animation.offset_x = 0;
56 e->animation.offset_y = 0;
57 float show3 = e->render_value(e->animation);
58
59 e->pixel.red = show1;
60 e->pixel.green = show2;
61 e->pixel.blue = show3;
62
63 e->pixel = e->rgb_sanity_check(e->pixel);
64
65 e->setPixelColorInternal(x, y, e->pixel);
66 }
67 }
68}
69
70
71// ============================================================================
72// Fixed-Point Implementation of SpiralMatrix2
73// ============================================================================
74
76 auto *e = ctx.mEngine.get();
77 e->get_ready();
78 mState.ensureCache(e);
79 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
80 const fl::u8 *perm = PERLIN_NOISE;
81
82 e->timings.master_speed = 0.03;
83 e->timings.ratio[0] = 0.025;
84 e->timings.ratio[1] = 0.027;
85 e->timings.ratio[2] = 0.031;
86 e->timings.ratio[3] = 0.0033;
87 e->timings.ratio[4] = 0.0036;
88 e->timings.ratio[5] = 0.0039;
89
90 e->calculate_oscillators(e->timings);
91
92 for (int x = 0; x < e->num_x; x++) {
93 for (int y = 0; y < e->num_y; y++) {
94
95 e->animation.dist = e->distance[x][y] * (e->move.directional[0]);
96 e->animation.angle = e->polar_theta[x][y] + e->move.radial[0];
97 e->animation.z = 5;
98 e->animation.scale_x = 0.09;
99 e->animation.scale_y = 0.09;
100 e->animation.offset_z = 5 * e->move.linear[0];
101 e->animation.offset_x = 0;
102 e->animation.offset_y = 0;
103 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
104
105 e->animation.dist = e->distance[x][y] * e->move.directional[1];
106 e->animation.angle = e->polar_theta[x][y] + e->move.radial[1];
107 e->animation.z = 50;
108 e->animation.scale_x = 0.07;
109 e->animation.scale_y = 0.07;
110 e->animation.offset_z = 5 * e->move.linear[1];
111 e->animation.offset_x = 0;
112 e->animation.offset_y = 0;
113 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
114
115 e->animation.dist = e->distance[x][y] * e->move.directional[2];
116 e->animation.angle = e->polar_theta[x][y] + e->move.radial[2];
117 e->animation.z = 500;
118 e->animation.scale_x = 0.05;
119 e->animation.scale_y = 0.05;
120 e->animation.offset_z = 5 * e->move.linear[2];
121 e->animation.offset_x = 0;
122 e->animation.offset_y = 0;
123 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
124
125 e->pixel.red = show1;
126 e->pixel.green = show2;
127 e->pixel.blue = show3;
128
129 e->pixel = e->rgb_sanity_check(e->pixel);
130
131 e->setPixelColorInternal(x, y, e->pixel);
132 }
133 }
134}
135
136} // namespace fl
137
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