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

◆ draw()

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

Implements fl::IAnimartrix2Viz.

Definition at line 81 of file spiralus.cpp.hpp.

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

+ Here is the call graph for this function: