@@ -6221,12 +6221,22 @@ uint16_t mode_2Dplasmarotozoom() {
62216221 const int cols = SEG_W;
62226222 const int rows = SEG_H;
62236223
6224- unsigned dataSize = sizeof (float );
6224+ unsigned dataSize = SEGMENT. length () + sizeof (float );
62256225 if (!SEGENV.allocateData (dataSize)) return mode_static (); // allocation failed
62266226 float *a = reinterpret_cast <float *>(SEGENV.data );
6227+ byte *plasma = reinterpret_cast <byte*>(SEGENV.data +sizeof (float ));
62276228
62286229 unsigned ms = strip.now /15 ;
62296230
6231+ // plasma
6232+ for (int j = 0 ; j < rows; j++) {
6233+ int index = j*cols;
6234+ for (int i = 0 ; i < cols; i++) {
6235+ if (SEGMENT.check1 ) plasma[index+i] = (i * 4 ^ j * 4 ) + ms / 6 ;
6236+ else plasma[index+i] = inoise8 (i * 40 , j * 40 , ms);
6237+ }
6238+ }
6239+
62306240 // rotozoom
62316241 float f = (sin_t (*a/2 )+((128 -SEGMENT.intensity )/128 .0f )+1 .1f )/1 .5f ; // scale factor
62326242 float kosinus = cos_t (*a) * f;
@@ -6235,14 +6245,9 @@ uint16_t mode_2Dplasmarotozoom() {
62356245 float u1 = i * kosinus;
62366246 float v1 = i * sinus;
62376247 for (int j = 0 ; j < rows; j++) {
6238- unsigned u = abs8 (u1 - j * sinus) % cols;
6239- unsigned v = abs8 (v1 + j * kosinus) % rows;
6240- byte plasma;
6241- if (SEGMENT.check1 ) plasma = (u * 4 ^ v * 4 ) + ms / 6 ;
6242- else plasma = perlin8 (u * 40 , v * 40 , ms);
6243- // else plasma = inoise8(u * SEGMENT.intensity, v * SEGMENT.intensity, ms);
6244- // SEGMENT.setPixelColorXY(i, j, SEGMENT.color_from_palette(plasma[v*cols+u], false, PALETTE_SOLID_WRAP, 255));
6245- SEGMENT.setPixelColorXY (i, j, SEGMENT.color_from_palette (plasma, false , PALETTE_SOLID_WRAP, 255 ));
6248+ byte u = abs8 (u1 - j * sinus) % cols;
6249+ byte v = abs8 (v1 + j * kosinus) % rows;
6250+ SEGMENT.setPixelColorXY (i, j, SEGMENT.color_from_palette (plasma[v*cols+u], false , PALETTE_SOLID_WRAP, 255 ));
62466251 }
62476252 }
62486253 *a -= 0 .03f + float (SEGENV.speed -128 )*0 .0002f ; // rotation speed
0 commit comments