| 17 | namespace fl { |
| 18 | |
| 19 | NoisePalette::NoisePalette(XYMap xyMap, float fps) |
| 20 | : Fx2d(xyMap), speed(0), scale(0), colorLoop(1), mFps(fps) { |
| 21 | // currentPalette = PartyColors_p; |
| 22 | FL_STATIC_ASSERT(sizeof(currentPalette) == sizeof(CRGBPalette16), |
| 23 | "Palette size mismatch"); |
| 24 | currentPalette = PartyColors_p; |
| 25 | width = xyMap.getWidth(); |
| 26 | height = xyMap.getHeight(); |
| 27 | |
| 28 | // Initialize our coordinates to some random values |
| 29 | mX = random16(); |
| 30 | mY = random16(); |
| 31 | mZ = random16(); |
| 32 | |
| 33 | setPalettePreset(0); |
| 34 | |
| 35 | // Allocate memory for the noise array using vector |
| 36 | noise.resize(width * height); |
| 37 | } |
| 38 | |
| 39 | void NoisePalette::setPalettePreset(int paletteIndex) { |
| 40 | currentPaletteIndex = paletteIndex % 12; // Ensure the index wraps around |