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

◆ fillFrameBufferFire()

void fillFrameBufferFire ( uint32_t now)

Definition at line 608 of file curr.h.

608 {
609 fl::CRGBPalette16 myPal = getFirePalette();
610
611 // Calculate the current y-offset for animation (makes the fire move)
612 uint32_t y_speed = now * fireSpeedY.value();
613
614 int width = frameBufferPtr->width();
615 int height = frameBufferPtr->height();
616
617 // Loop through every pixel in our cylindrical matrix
618 for (int w = 0; w < width; w++) {
619 for (int h = 0; h < height; h++) {
620 // Calculate which color to use from our palette for this pixel
621 uint8_t palette_index =
622 getFirePaletteIndex(now, w, width, h, height, y_speed);
623
624 // Get the actual RGB color from the palette
625 fl::CRGB color = ColorFromPalette(myPal, palette_index, 255);
626
627 // Apply color boost using ease functions
628 fl::EaseType sat_ease = getEaseType(saturationFunction.value());
629 fl::EaseType lum_ease = getEaseType(luminanceFunction.value());
630 color = color.colorBoost(sat_ease, lum_ease);
631
632 // Set the pixel in the frame buffer
633 // Flip coordinates to make fire rise from bottom
634 frameBufferPtr->at((width - 1) - w, (height - 1) - h) = color;
635 }
636 }
637}
fl::UIDropdown saturationFunction("Saturation Function", easeOptions)
fl::UIDropdown luminanceFunction("Luminance Function", easeOptions)
int y_speed
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
fl::EaseType getEaseType(fl::string value)
Definition curr.h:129
fl::UISlider fireSpeedY("Fire SpeedY", 1.3, 1, 6,.1)
fl::CRGBPalette16 getFirePalette()
Definition curr.h:566
fl::shared_ptr< fl::Grid< fl::CRGB > > frameBufferPtr
Definition curr.h:279
uint8_t getFirePaletteIndex(uint32_t millis32, int width, int max_width, int height, int max_height, uint32_t y_speed)
Definition curr.h:580
fl::u32 uint32_t
Definition s16x16x4.h:219
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186
EaseType
Definition ease.h:27
unsigned char uint8_t
Definition s16x16x4.h:209
CRGB colorBoost(EaseType saturation_function=EaseType::EASE_NONE, EaseType luminance_function=EaseType::EASE_NONE) const FL_NOEXCEPT
Representation of an 8-bit RGB pixel (Red, Green, Blue)
Definition crgb.h:38

References fl::CRGB::colorBoost(), ColorFromPalette(), fireSpeedY(), frameBufferPtr, getEaseType(), getFirePalette(), getFirePaletteIndex(), luminanceFunction(), saturationFunction(), and y_speed.

Referenced by drawFire().

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