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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

Definition at line 107 of file parametric_water.cpp.hpp.

107 {
108 auto *e = ctx.mEngine.get();
109 e->get_ready();
110 mState.ensureCache(e);
111 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
112 const fl::u8 *perm = PERLIN_NOISE;
113
114 e->timings.master_speed = 0.003;
115 e->timings.ratio[0] = 0.025;
116 e->timings.ratio[1] = 0.027;
117 e->timings.ratio[2] = 0.029;
118 e->timings.ratio[3] = 0.033;
119 e->timings.ratio[4] = 0.037;
120 e->timings.ratio[5] = 0.15;
121 e->timings.ratio[6] = 0.41;
122
123 e->calculate_oscillators(e->timings);
124
125 for (int x = 0; x < e->num_x; x++) {
126 for (int y = 0; y < e->num_y; y++) {
127
128 float s = 4;
129 float f = 10 + 2 * e->move.directional[0];
130
131 e->animation.dist = (f + e->move.directional[0]) *
132 fl::sinf(-e->move.radial[5] + e->move.radial[0] +
133 (e->distance[x][y] / (s)));
134 e->animation.angle = 1 * e->polar_theta[x][y];
135 e->animation.z = 5;
136 e->animation.scale_x = 0.1;
137 e->animation.scale_y = 0.1;
138 e->animation.offset_z = -10;
139 e->animation.offset_y = 20 * e->move.linear[0];
140 e->animation.offset_x = 10;
141 e->animation.low_limit = 0;
142 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
143
144 e->animation.dist = (f + e->move.directional[1]) *
145 fl::sinf(-e->move.radial[5] + e->move.radial[1] +
146 (e->distance[x][y] / (s)));
147 e->animation.angle = 1 * e->polar_theta[x][y];
148 e->animation.z = 500;
149 e->animation.scale_x = 0.1;
150 e->animation.scale_y = 0.1;
151 e->animation.offset_z = -10;
152 e->animation.offset_y = 20 * e->move.linear[1];
153 e->animation.offset_x = 10;
154 e->animation.low_limit = 0;
155 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
156
157 e->animation.dist = (f + e->move.directional[2]) *
158 fl::sinf(-e->move.radial[5] + e->move.radial[2] +
159 (e->distance[x][y] / (s)));
160 e->animation.angle = 1 * e->polar_theta[x][y];
161 e->animation.z = 5000;
162 e->animation.scale_x = 0.1;
163 e->animation.scale_y = 0.1;
164 e->animation.offset_z = -10;
165 e->animation.offset_y = 20 * e->move.linear[2];
166 e->animation.offset_x = 10;
167 e->animation.low_limit = 0;
168 e->show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
169
170 e->animation.dist = (f + e->move.directional[3]) *
171 fl::sinf(-e->move.radial[5] + e->move.radial[3] +
172 (e->distance[x][y] / (s)));
173 e->animation.angle = 1 * e->polar_theta[x][y];
174 e->animation.z = 2000;
175 e->animation.scale_x = 0.1;
176 e->animation.scale_y = 0.1;
177 e->animation.offset_z = -10;
178 e->animation.offset_y = 20 * e->move.linear[3];
179 e->animation.offset_x = 10;
180 e->animation.low_limit = 0;
181 e->show5 = render_value_fp_from_float(e->animation, fade_lut, perm);
182
183 e->show6 = e->screen(e->show4, e->show5);
184 e->show7 = e->screen(e->show2, e->show3);
185
186 float radius = 40;
187 float radial = (radius - e->distance[x][y]) / radius;
188
189 e->pixel.red = e->pixel.blue - 40;
190 e->pixel.green = 0;
191 e->pixel.blue = (0.3 * e->show6 + 0.7 * e->show7) * radial;
192
193 e->pixel = e->rgb_sanity_check(e->pixel);
194
195 e->setPixelColorInternal(x, y, e->pixel);
196 }
197 }
198}
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
float sinf(float value) FL_NO_EXCEPT
Definition math.h:360

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

+ Here is the call graph for this function: