FastLED 3.10.8
Loading...
Searching...
No Matches

◆ draw()

void fl::Spiralus2_FP::draw ( Context & ctx)
overridevirtual

Implements fl::IAnimartrix2Viz.

Definition at line 83 of file spiralus2.cpp.hpp.

83 {
84 auto *e = ctx.mEngine.get();
85 e->get_ready();
86 mState.ensureCache(e);
87 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
88 const fl::u8 *perm = PERLIN_NOISE;
89
90 e->timings.master_speed = 0.0015;
91 e->timings.ratio[0] = 1.5;
92 e->timings.ratio[1] = 2.3;
93 e->timings.ratio[2] = 3;
94 e->timings.ratio[3] = 0.05;
95 e->timings.ratio[4] = 0.2;
96 e->timings.ratio[5] = 0.05;
97 e->timings.ratio[6] = 0.055;
98 e->timings.ratio[7] = 0.06;
99 e->timings.ratio[8] = 0.027;
100 e->timings.offset[0] = 0;
101 e->timings.offset[1] = 100;
102 e->timings.offset[2] = 200;
103 e->timings.offset[3] = 300;
104 e->timings.offset[4] = 400;
105 e->timings.offset[5] = 500;
106 e->timings.offset[6] = 600;
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] + e->move.noise_angle[5] +
114 e->move.directional[3] * e->move.noise_angle[6] *
115 e->animation.dist / 10;
116 e->animation.scale_x = 0.08;
117 e->animation.scale_y = 0.08;
118 e->animation.scale_z = 0.02;
119 e->animation.offset_y = -e->move.linear[0];
120 e->animation.offset_x = 0;
121 e->animation.offset_z = 0;
122 e->animation.z = e->move.linear[1];
123 float show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
124
125 e->animation.angle = 6 * e->polar_theta[x][y] + e->move.noise_angle[7] +
126 e->move.directional[5] * e->move.noise_angle[8] *
127 e->animation.dist / 10;
128 e->animation.offset_y = -e->move.linear[1];
129 e->animation.z = e->move.linear[2];
130 float show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
131
132 e->animation.angle = 6 * e->polar_theta[x][y] + e->move.noise_angle[6] +
133 e->move.directional[6] * e->move.noise_angle[7] *
134 e->animation.dist / 10;
135 e->animation.offset_y = e->move.linear[2];
136 e->animation.z = e->move.linear[0];
137 e->animation.dist = e->distance[x][y] * 0.8;
138 float show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
139
140 float f = 1;
141
142 e->pixel.red = f * (show1 + show2);
143 e->pixel.green = f * (show1 - show2);
144 e->pixel.blue = f * (show3 - show1);
145
146 e->pixel = e->rgb_sanity_check(e->pixel);
147 e->setPixelColorInternal(x, y, e->pixel);
148 }
149 }
150}
FPVizState mState
Definition spiralus2.h:23
T * assume_aligned(T *ptr) FL_NO_EXCEPT
Definition s16x16x4.h:126
unsigned char u8
Definition stdint.h:131
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

References fl::fl::assume_aligned(), fl::FL_NO_EXCEPT, mState, fl::render_value_fp_from_float(), fl::x, and fl::y.

+ Here is the call graph for this function: