FastLED 3.10.8
Loading...
Searching...
No Matches

◆ init()

void fl::WaveSimulation2D::init ( u32 width,
u32 height,
SuperSample factor,
float speed,
int dampening )

Definition at line 42 of file wave_simulation.cpp.hpp.

43 {
46 mMultiplier = static_cast<u32>(factor);
47 mSim.reset(); // clear out memory first.
48 u32 w = width * mMultiplier;
49 u32 h = height * mMultiplier;
51 // Auto-select the 9-point isotropic Laplacian when super-sampling is
52 // active: the 5-point stencil's anisotropy (square-ish ripples) is
53 // invisible at the native LED-grid resolution but becomes obvious
54 // at 2x and higher super-sample factors. The 9-point form costs ~2x
55 // reads + ALU per cell but the user has already opted into more CPU
56 // by requesting super-sampling.
57 if (mMultiplier >= 2) {
59 }
60 // Only allocate change grid if it's enabled (saves memory when disabled)
61 if (mUseChangeGrid) {
62 mChangeGrid.reset(w, h);
63 }
64 // Extra frames are needed because the simulation slows down in
65 // proportion to the supersampling factor.
66 mExtraFrames = u8(factor) - 1;
67}
uint16_t speed
Definition Noise.ino:72
fl::Grid< i16 > mChangeGrid
fl::unique_ptr< WaveSimulation2D_Real > mSim
fl::UISlider dampening("Dampening", 6.0f, 0.0f, 10.0f, 0.1f)
fl::enable_if<!fl::is_array< T >::value, unique_ptr< T > >::type make_unique(Args &&... args) FL_NO_EXCEPT
Definition unique_ptr.h:263
unsigned char u8
Definition stdint.h:131
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186

References dampening(), fl::FL_NO_EXCEPT, fl::height, fl::adl_barrier::make_unique(), mChangeGrid, mExtraFrames, mMultiplier, mOuterHeight, mOuterWidth, mSim, mUseChangeGrid, fl::NinePointIsotropic, speed, and fl::width.

Referenced by setSuperSample().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: