Browse Source

reverted accidentally checked in plasma code

feature/2015
Christian Kroll 13 years ago
parent
commit
36c1919153
  1. 60
      animations/fpmath_patterns.c

60
animations/fpmath_patterns.c

@ -4,7 +4,6 @@
#include "../pixel.h"
#include "../util.h"
#include "fpmath_patterns.h"
#include <inttypes.h>
#define DOUBLE_BUFFERING
#ifdef DOUBLE_BUFFERING
@ -92,63 +91,6 @@ static void fpmath_pattern(double const t_start,
#ifdef ANIMATION_PLASMA
#define PLASMA_X (1.0 / (NUM_COLS / (2.0 * M_PI)))
#define INTEGERFUN 1
#ifdef INTEGERFUN
//XXX this is inefficient, as we could as this is a 2*PI sine and we'd really need only half of it - hansi
const uint8_t sine_table[32] =
{
128,152,176,198,218,234,245,253,255,253,245,234,218,198,176,152,
128,103,79,57,37,21,10,2,0,2,10,21,37,57,79,103
};
uint8_t sin_i(uint8_t phase)
{
return sine_table[phase >> 3];
}
#define SQRT0x8000 181
#define SQRT25x3 0x45483
void plasma(void)
{
uint8_t sqx, x, y, scale = 3, off = 0;
#ifdef DOUBLE_BUFFERING
// double buffering to reduce half painted pictures
unsigned char pixmap_buffer[NUMPLANE][NUM_ROWS][LINEBYTES];
#endif
while (off < 200)
{
for(x = 0; x < NUM_COLS; x++)
{
sqx = x*x;
for(y = 0; y < NUM_ROWS; y++)
{
unsigned char const mask = shl_table[y % 8U];
unsigned char const color = (uint16_t)sin_i(sqrt((uint16_t)sqx + ((uint16_t)y*(uint16_t)y)) * (255*255 / ((scale * NUM_COLS) / 2)) + off) * (NUMPLANE - 1) / 255 ;
unsigned char const x_8 = x / 8u;
for (unsigned char p = 0; p < NUMPLANE; ++p)
{
if (p <= (color - 1))
{
BUFFER[p][y][x_8] |= mask;
}
else
{
BUFFER[p][y][x_8] &= ~mask;
}
}
}
}
#ifdef DOUBLE_BUFFERING
memcpy(pixmap, pixmap_buffer, sizeof(pixmap));
#endif
}
}
#else
/**
* Draws a simple plasma like pattern.
*/
@ -181,8 +123,6 @@ void plasma(void)
}
#endif
#endif /* INTEGERFUN */
#ifdef ANIMATION_PSYCHEDELIC
/**

Loading…
Cancel
Save