FastLED 3.9.15
Loading...
Searching...
No Matches

◆ draw()

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

Implements fl::IAnimartrix2Viz.

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

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

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

+ Here is the call graph for this function: