PolarLights and Octopus: deterministic + SuperSync control
FX.cpp - SuperSync control on Polar lights and Octopus: only calculate pixels for the first panel
This commit is contained in:
@@ -5481,7 +5481,6 @@ uint16_t mode_2DPolarLights(void) { // By: Kostyantyn Matviyevskyy https
|
||||
if (SEGENV.call == 0) {
|
||||
SEGMENT.setUpLeds();
|
||||
SEGMENT.fill(BLACK);
|
||||
SEGENV.step = 0;
|
||||
}
|
||||
|
||||
float adjustHeight = (float)map(rows, 8, 32, 28, 12); // maybe use mapf() ???
|
||||
@@ -5504,19 +5503,35 @@ uint16_t mode_2DPolarLights(void) { // By: Kostyantyn Matviyevskyy https
|
||||
uint16_t _scale = map(SEGMENT.intensity, 0, 255, 30, adjScale);
|
||||
byte _speed = map(SEGMENT.speed, 0, 255, 128, 16);
|
||||
|
||||
for (int x = 0; x < cols; x++) {
|
||||
for (int y = 0; y < rows; y++) {
|
||||
SEGENV.step++;
|
||||
SEGMENT.setPixelColorXY(x, y, ColorFromPalette(auroraPalette,
|
||||
qsub8(
|
||||
inoise8((SEGENV.step%2) + x * _scale, y * 16 + SEGENV.step % 16, SEGENV.step / _speed),
|
||||
fabsf((float)rows / 2.0f - (float)y) * adjustHeight)));
|
||||
//WLEDMM add SuperSync control
|
||||
uint16_t xStart, xEnd, yStart, yEnd;
|
||||
if (SEGMENT.check1) { //Master (sync on needs to show the whole effect, children only their first panel)
|
||||
xStart = strip.panel[0].xOffset;
|
||||
xEnd = strip.panel[0].xOffset + strip.panel[0].width;
|
||||
yStart = strip.panel[0].yOffset;
|
||||
yEnd = strip.panel[0].yOffset + strip.panel[0].height;
|
||||
}
|
||||
else {
|
||||
xStart = 0;
|
||||
xEnd = cols;
|
||||
yStart = 0;
|
||||
yEnd = rows;
|
||||
}
|
||||
|
||||
SEGENV.step = strip.now / 25 * (cols * rows); //40fps
|
||||
for (int x = xStart; x < xEnd; x++) {
|
||||
for (int y = yStart; y < yEnd; y++) {
|
||||
SEGENV.step++;
|
||||
SEGMENT.setPixelColorXY(x, y, ColorFromPalette(auroraPalette,
|
||||
qsub8(
|
||||
inoise8((SEGENV.step%2) + x * _scale, y * 16 + SEGENV.step % 16, SEGENV.step / _speed),
|
||||
fabsf((float)rows / 2.0f - (float)y) * adjustHeight)));
|
||||
}
|
||||
}
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_2DPolarLights()
|
||||
static const char _data_FX_MODE_2DPOLARLIGHTS[] PROGMEM = "Polar Lights@!,Scale;;;2";
|
||||
static const char _data_FX_MODE_2DPOLARLIGHTS[] PROGMEM = "Polar Lights@!,Scale,,,,SuperSync;;;2";
|
||||
|
||||
|
||||
/////////////////////////
|
||||
@@ -7982,6 +7997,21 @@ uint16_t mode_2Doctopus() {
|
||||
uint8_t *offsX = reinterpret_cast<uint8_t*>(SEGENV.data + dataSize);
|
||||
uint8_t *offsY = reinterpret_cast<uint8_t*>(SEGENV.data + dataSize + 1);
|
||||
|
||||
//WLEDMM add SuperSync control
|
||||
uint16_t xStart, xEnd, yStart, yEnd;
|
||||
if (SEGMENT.check1) { //Master (sync on needs to show the whole effect, children only their first panel)
|
||||
xStart = strip.panel[0].xOffset;
|
||||
xEnd = strip.panel[0].xOffset + strip.panel[0].width;
|
||||
yStart = strip.panel[0].yOffset;
|
||||
yEnd = strip.panel[0].yOffset + strip.panel[0].height;
|
||||
}
|
||||
else {
|
||||
xStart = 0;
|
||||
xEnd = cols;
|
||||
yStart = 0;
|
||||
yEnd = rows;
|
||||
}
|
||||
|
||||
// re-init if SEGMENT dimensions or offset changed
|
||||
if (SEGENV.call == 0 || SEGENV.aux0 != cols || SEGENV.aux1 != rows || SEGMENT.custom1 != *offsX || SEGMENT.custom2 != *offsY) {
|
||||
if (!true) //WLEDMM SuperSync
|
||||
@@ -7992,8 +8022,8 @@ uint16_t mode_2Doctopus() {
|
||||
*offsY = SEGMENT.custom2;
|
||||
const uint8_t C_X = cols / 2 + (SEGMENT.custom1 - 128)*cols/255;
|
||||
const uint8_t C_Y = rows / 2 + (SEGMENT.custom2 - 128)*rows/255;
|
||||
for (int x = 0; x < cols; x++) {
|
||||
for (int y = 0; y < rows; y++) {
|
||||
for (int x = xStart; x < xEnd; x++) {
|
||||
for (int y = yStart; y < yEnd; y++) {
|
||||
rMap[XY(x, y)].angle = 40.7436f * atan2f(y - C_Y, x - C_X); // avoid 128*atan2()/PI
|
||||
rMap[XY(x, y)].radius = hypotf(x - C_X, y - C_Y) * mapp; //thanks Sutaburosu
|
||||
}
|
||||
@@ -8001,12 +8031,12 @@ uint16_t mode_2Doctopus() {
|
||||
}
|
||||
|
||||
if (true) // WLEDMM SuperSync
|
||||
SEGENV.step = (strip.now / 40) * (SEGMENT.speed / 32 + 1); // WLEDMM 40fps
|
||||
SEGENV.step = (strip.now / 25) * (SEGMENT.speed / 32 + 1); // WLEDMM 40fps
|
||||
else
|
||||
SEGENV.step += SEGMENT.speed / 32 + 1; // 1-4 range
|
||||
|
||||
for (int x = 0; x < cols; x++) {
|
||||
for (int y = 0; y < rows; y++) {
|
||||
for (int x = xStart; x < xEnd; x++) {
|
||||
for (int y = yStart; y < yEnd; y++) {
|
||||
byte angle = rMap[XY(x,y)].angle;
|
||||
byte radius = rMap[XY(x,y)].radius;
|
||||
//CRGB c = CHSV(SEGENV.step / 2 - radius, 255, sin8(sin8((angle * 4 - radius) / 4 + SEGENV.step) + radius - SEGENV.step * 2 + angle * (SEGMENT.custom3/3+1)));
|
||||
@@ -8018,7 +8048,7 @@ uint16_t mode_2Doctopus() {
|
||||
}
|
||||
return FRAMETIME;
|
||||
}
|
||||
static const char _data_FX_MODE_2DOCTOPUS[] PROGMEM = "Octopus@!,,Offset X,Offset Y,Legs;;!;2;";
|
||||
static const char _data_FX_MODE_2DOCTOPUS[] PROGMEM = "Octopus@!,,Offset X,Offset Y,Legs, SuperSync;;!;2;";
|
||||
|
||||
|
||||
//Waving Cell
|
||||
|
||||
Reference in New Issue
Block a user