make getPixelColor matrix (mapping) aware
And change some mapping defaults of effects useing getPixelColor
This commit is contained in:
parent
615f807909
commit
aeb8fd6fda
@ -6647,7 +6647,7 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_matripix()
|
||||
static const char *_data_FX_MODE_MATRIPIX PROGMEM = " ♪ Matripix@!,Brightness=64;,!;!;mp12=0;ssim=0;rev=1"; // Pixel, Beatsin, reverseX
|
||||
static const char *_data_FX_MODE_MATRIPIX PROGMEM = " ♪ Matripix@!,Brightness=64;,!;!;mp12=2;ssim=1;rev=1"; // Circle, Beatsin, reverseX
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6790,7 +6790,7 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_pixelwave()
|
||||
static const char *_data_FX_MODE_PIXELWAVE PROGMEM = " ♪ Pixelwave@!,Sensitivity=64;!,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_PIXELWAVE PROGMEM = " ♪ Pixelwave@!,Sensitivity=64;!,!;!;mp12=2;ssim=0"; // Circle, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -7131,7 +7131,7 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_freqmap()
|
||||
static const char *_data_FX_MODE_FREQMAP PROGMEM = " ♫ Freqmap@Fade rate,Starting color;,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_FREQMAP PROGMEM = " ♫ Freqmap@Fade rate,Starting color;,!;!;mp12=2;ssim=0"; // Circle, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -7288,7 +7288,7 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_freqwave()
|
||||
static const char *_data_FX_MODE_FREQWAVE PROGMEM = " ♫ Freqwave@Time delay,Sound effect,Low bin,High bin,Pre-amp;;;mp12=0;ssim=0"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_FREQWAVE PROGMEM = " ♫ Freqwave@Time delay,Sound effect,Low bin,High bin,Pre-amp;;;mp12=2;ssim=0"; // Circle, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -7464,7 +7464,7 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_waterfall()
|
||||
static const char *_data_FX_MODE_WATERFALL PROGMEM = " ♫ Waterfall@!,Adjust color,,Select bin, Volume (minimum)=0;!,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_WATERFALL PROGMEM = " ♫ Waterfall@!,Adjust color,,Select bin, Volume (minimum)=0;!,!;!;mp12=2;ssim=0"; // Circles, Beatsin
|
||||
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
|
@ -276,7 +276,30 @@ void Segment::setPixelColor(float i, uint32_t col, bool aa)
|
||||
|
||||
uint32_t Segment::getPixelColor(uint16_t i)
|
||||
{
|
||||
if (getOption(SEG_OPTION_REVERSED)) i = virtualLength() - i - 1;
|
||||
if (strip.isMatrix) {
|
||||
switch (SEGMENT.mapping12) {
|
||||
case M12_Pixels:
|
||||
return getPixelColorXY(i%SEGMENT.virtualWidth(), i/SEGMENT.virtualWidth());
|
||||
break;
|
||||
case M12_VerticalBar:
|
||||
// map linear pixel into 2D segment area (even for 1D segments, expanding vertically)
|
||||
return getPixelColorXY(i, 0);
|
||||
break;
|
||||
case M12_Circle:
|
||||
{
|
||||
int x = roundf(roundf((SEGMENT.virtualWidth() / 2) * 10)/10);
|
||||
int y = roundf(roundf((i + SEGMENT.virtualHeight() / 2) * 10)/10);
|
||||
return getPixelColorXY(x,y);
|
||||
}
|
||||
break;
|
||||
case M12_Block:
|
||||
return getPixelColorXY(SEGMENT.virtualWidth() / 2, SEGMENT.virtualHeight() / 2 - i - 1);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (getOption(SEG_OPTION_REVERSED)) i = strip.getMappingLength() - i - 1;
|
||||
i *= groupLength();
|
||||
i += start;
|
||||
/* offset/phase */
|
||||
|
Loading…
Reference in New Issue
Block a user