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

◆ fillFrameBufferFire()

void fillFrameBufferFire ( uint32_t now)

Definition at line 620 of file curr.h.

620 {
621 CRGBPalette16 myPal = getFirePalette();
622
623 // Calculate the current y-offset for animation (makes the fire move)
624 uint32_t y_speed = now * fireSpeedY.value();
625
626 int width = frameBufferPtr->width();
627 int height = frameBufferPtr->height();
628
629 // Loop through every pixel in our cylindrical matrix
630 for (int w = 0; w < width; w++) {
631 for (int h = 0; h < height; h++) {
632 // Calculate which color to use from our palette for this pixel
633 uint8_t palette_index =
634 getFirePaletteIndex(now, w, width, h, height, y_speed);
635
636 // Get the actual RGB color from the palette
637 CRGB color = ColorFromPalette(myPal, palette_index, 255);
638
639 // Apply color boost using ease functions
640 EaseType sat_ease = getEaseType(saturationFunction.value());
641 EaseType lum_ease = getEaseType(luminanceFunction.value());
642 color = color.colorBoost(sat_ease, lum_ease);
643
644 // Set the pixel in the frame buffer
645 // Flip coordinates to make fire rise from bottom
646 frameBufferPtr->at((width - 1) - w, (height - 1) - h) = color;
647 }
648 }
649}
UIDropdown luminanceFunction("Luminance Function", easeOptions)
UIDropdown saturationFunction("Saturation Function", easeOptions)
int y_speed
CRGBPalette16 getFirePalette()
Definition curr.h:578
uint8_t getFirePaletteIndex(uint32_t millis32, int width, int max_width, int height, int max_height, uint32_t y_speed)
Definition curr.h:592
UISlider fireSpeedY("Fire SpeedY", 1.3, 1, 6,.1)
fl::shared_ptr< Grid< CRGB > > frameBufferPtr
Definition curr.h:291
EaseType getEaseType(fl::string value)
Definition curr.h:142
CRGB ColorFromPalette(const CRGBPalette16 &pal, fl::u8 index, fl::u8 brightness, TBlendType blendType)
EaseType
Definition ease.h:21
CRGB colorBoost(fl::EaseType saturation_function=fl::EASE_NONE, fl::EaseType luminance_function=fl::EASE_NONE) const
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86

References CRGB::colorBoost(), fl::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: