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

◆ renderDebris()

void fl::PerlinParticlePunch::renderDebris ( const DebrisParticle & d)
private

Definition at line 360 of file perlin_particle_punch.cpp.hpp.

360 {
361 int idx = int(d.position);
362 float frac = d.position - float(idx);
363 u8 bri = clamp_u8(d.brightness);
364 CRGB pixel = d.color;
365 pixel.nscale8(bri);
366
367 if (idx >= 0 && idx < mNumLeds) {
368 CRGB main = pixel;
369 main.nscale8(clamp_u8((1.0f - frac) * 255.0f));
370 writeMax(mTrailBuffer[idx], main);
371 }
372 int nextIdx = idx + 1;
373 if (nextIdx >= 0 && nextIdx < mNumLeds && frac > 0.01f) {
374 CRGB sub = pixel;
375 sub.nscale8(clamp_u8(frac * 255.0f));
376 writeMax(mTrailBuffer[nextIdx], sub);
377 }
378}
u16 mNumLeds
Definition fx.h:53
static void writeMax(CRGB &dst, const CRGB &src)
unsigned char u8
Definition stdint.h:131
fl::CRGB CRGB
Definition video.h:15
CRGB & nscale8(u8 scaledown) FL_NOEXCEPT
Scale down a RGB to N/256ths of its current brightness, using "plain math" dimming rules.
Definition crgb.cpp.hpp:88

References fl::PerlinParticlePunch::DebrisParticle::brightness, fl::PerlinParticlePunch::DebrisParticle::color, fl::Fx::mNumLeds, mTrailBuffer, fl::CRGB::nscale8(), fl::PerlinParticlePunch::DebrisParticle::position, and writeMax().

Referenced by draw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: