FastLED 3.9.15
Loading...
Searching...
No Matches

◆ init()

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

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

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

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

Referenced by WaveSimulation2D(), and setSuperSample().

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