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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

Definition at line 99 of file water.cpp.hpp.

99 {
100 auto *e = ctx.mEngine.get();
101 e->get_ready();
102 mState.ensureCache(e);
103 const fl::i32 *fade_lut = fl::assume_aligned<16>(mState.fade_lut);
104 const fl::u8 *perm = PERLIN_NOISE;
105
106 e->timings.master_speed = 0.037;
107 e->timings.ratio[0] = 0.025;
108 e->timings.ratio[1] = 0.027;
109 e->timings.ratio[2] = 0.031;
110 e->timings.ratio[3] = 0.033;
111 e->timings.ratio[4] = 0.037;
112 e->timings.ratio[5] = 0.1;
113 e->timings.ratio[6] = 0.41;
114
115 e->calculate_oscillators(e->timings);
116
117 for (int x = 0; x < e->num_x; x++) {
118 for (int y = 0; y < e->num_y; y++) {
119
120 e->animation.dist =
121 e->distance[x][y] +
122 4 * fl::sinf(e->move.directional[5] * PI + (float)x / 2) +
123 4 * fl::cosf(e->move.directional[6] * PI + float(y) / 2);
124 e->animation.angle = 1 * e->polar_theta[x][y];
125 e->animation.z = 5;
126 e->animation.scale_x = 0.06;
127 e->animation.scale_y = 0.06;
128 e->animation.offset_z = -10 * e->move.linear[0];
129 e->animation.offset_y = 10;
130 e->animation.offset_x = 10;
131 e->animation.low_limit = 0;
132 e->show1 = render_value_fp_from_float(e->animation, fade_lut, perm);
133
134 e->animation.dist = (10 + e->move.directional[0]) *
135 fl::sinf(-e->move.radial[5] + e->move.radial[0] +
136 (e->distance[x][y] / (3)));
137 e->animation.angle = 1 * e->polar_theta[x][y];
138 e->animation.z = 5;
139 e->animation.scale_x = 0.1;
140 e->animation.scale_y = 0.1;
141 e->animation.offset_z = -10;
142 e->animation.offset_y = 20 * e->move.linear[0];
143 e->animation.offset_x = 10;
144 e->animation.low_limit = 0;
145 e->show2 = render_value_fp_from_float(e->animation, fade_lut, perm);
146
147 e->animation.dist = (10 + e->move.directional[1]) *
148 fl::sinf(-e->move.radial[5] + e->move.radial[1] +
149 (e->distance[x][y] / (3)));
150 e->animation.angle = 1 * e->polar_theta[x][y];
151 e->animation.z = 500;
152 e->animation.scale_x = 0.1;
153 e->animation.scale_y = 0.1;
154 e->animation.offset_z = -10;
155 e->animation.offset_y = 20 * e->move.linear[1];
156 e->animation.offset_x = 10;
157 e->animation.low_limit = 0;
158 e->show3 = render_value_fp_from_float(e->animation, fade_lut, perm);
159
160 e->animation.dist = (10 + e->move.directional[2]) *
161 fl::sinf(-e->move.radial[5] + e->move.radial[2] +
162 (e->distance[x][y] / (3)));
163 e->animation.angle = 1 * e->polar_theta[x][y];
164 e->animation.z = 500;
165 e->animation.scale_x = 0.1;
166 e->animation.scale_y = 0.1;
167 e->animation.offset_z = -10;
168 e->animation.offset_y = 20 * e->move.linear[2];
169 e->animation.offset_x = 10;
170 e->animation.low_limit = 0;
171 e->show4 = render_value_fp_from_float(e->animation, fade_lut, perm);
172
173 e->pixel.blue = (0.7 * e->show2 + 0.6 * e->show3 + 0.5 * e->show4);
174 e->pixel.red = e->pixel.blue - 40;
175 e->pixel.green = 0;
176
177 e->pixel = e->rgb_sanity_check(e->pixel);
178
179 e->setPixelColorInternal(x, y, e->pixel);
180 }
181 }
182}
#define PI
FPVizState mState
Definition water.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
float sinf(float value) FL_NO_EXCEPT
Definition math.h:360
float cosf(float value) FL_NO_EXCEPT
Definition math.h:366

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

+ Here is the call graph for this function: