| 57 | P ps[MAXP]; |
| 58 | |
| 59 | void resetParticle(P &p, uint32_t tt) { |
| 60 | // Original: x=360,y=360 (center), a=t*1.25 + noise(I)*W, f=t%2*2-1, g=I, |
| 61 | // s=5 |
| 62 | int I = (int)(tt / 50); |
| 63 | p.x = (WIDTH - 1) / 2.0f; |
| 64 | p.y = (HEIGHT - 1) / 2.0f; |
| 65 | |
| 66 | // noise(I)*W -> use 1D Perlin noise via inoise8 |
| 67 | uint8_t n1 = inoise8(I * 19); // arbitrary scale |
| 68 | float noiseW = (n1 / 255.0f) * WIDTH; |
| 69 | |
| 70 | p.a = tt * 1.25f + noiseW; // base angle component |
| 71 | p.f = (tt & 1) ? +1 : -1; // alternate direction |
| 72 | p.g = I; |
| 73 | p.s = 3.0f; // lower initial intensity for small grids |
| 74 | p.alive = true; |
| 75 | } |
| 76 | |
| 77 | inline void plotDot(int x, int y, uint8_t v) { |
| 78 | if (x < 0 || x >= WIDTH || y < 0 || y >= HEIGHT) |