mirror of
https://github.com/wled/WLED.git
synced 2025-04-23 14:27:18 +00:00
playing with Fire2012
* speedup: add functions to only blur rows or columns (50% faster) * fire2012: tinkering with bur options. Vertical blur only when slider < 64 (faster); extra blur for slider values >192 (bush burn)
This commit is contained in:
parent
7d7b7c1e25
commit
db5e66a9b0
@ -2098,7 +2098,7 @@ uint16_t mode_fire_2012() {
|
||||
|
||||
// Step 4. Map from heat cells to LED colors
|
||||
for (int j = 0; j < SEGLEN; j++) {
|
||||
SEGMENT.setPixelColor(indexToVStrip(j, stripNr), ColorFromPalette(SEGPALETTE, MIN(heat[j],240), 255, NOBLEND));
|
||||
SEGMENT.setPixelColor(indexToVStrip(j, stripNr), ColorFromPalette(SEGPALETTE, min(heat[j], byte(240)), 255, NOBLEND));
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -2108,7 +2108,9 @@ uint16_t mode_fire_2012() {
|
||||
|
||||
if (SEGMENT.is2D()) {
|
||||
uint8_t blurAmount = SEGMENT.custom2 >> 2;
|
||||
SEGMENT.blur(blurAmount);
|
||||
if (blurAmount > 48) blurAmount += blurAmount-48; // extra blur when slider > 192 (bush burn)
|
||||
if (blurAmount < 16) SEGMENT.blurCols(SEGMENT.custom2 >> 1); // no side-burn when slider < 64 (faster)
|
||||
else SEGMENT.blur(blurAmount);
|
||||
}
|
||||
|
||||
if (it != SEGENV.step)
|
||||
|
10
wled00/FX.h
10
wled00/FX.h
@ -602,6 +602,16 @@ typedef struct Segment {
|
||||
uint32_t color_from_palette(uint16_t, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri = 255) const;
|
||||
uint32_t color_wheel(uint8_t pos) const;
|
||||
|
||||
// 2D Blur: shortcuts for bluring columns or rows only (50% faster than full 2D blur)
|
||||
inline void blurCols(fract8 blur_amount, bool smear = false) { // blur all columns
|
||||
const unsigned cols = virtualWidth();
|
||||
for (unsigned k = 0; k < cols; k++) blurCol(k, blur_amount, smear);
|
||||
}
|
||||
inline void blurRows(fract8 blur_amount, bool smear = false) { // blur all rows
|
||||
const unsigned rows = virtualHeight();
|
||||
for ( unsigned i = 0; i < rows; i++) blurRow(i, blur_amount, smear);
|
||||
}
|
||||
|
||||
// 2D matrix
|
||||
uint16_t virtualWidth(void) const; // segment width in virtual pixels (accounts for groupping and spacing)
|
||||
uint16_t virtualHeight(void) const; // segment height in virtual pixels (accounts for groupping and spacing)
|
||||
|
Loading…
x
Reference in New Issue
Block a user