FastLED 3.10.8
Loading...
Searching...
No Matches
fl::FlowFieldFP Class Reference

Detailed Description

Pure fixed-point (s16x16) flow field implementation for maximum speed.

All internal computation uses Q16.16 fixed-point arithmetic — no float operations in any code path. Public API accepts float parameters which are converted to s16x16 before each draw.

Examples
FlowField.ino.

Definition at line 360 of file flowfield.h.

#include <flowfield.h>

+ Inheritance diagram for fl::FlowFieldFP:
+ Collaboration diagram for fl::FlowFieldFP:

Public Member Functions

 FlowFieldFP (const XYMap &xyMap, const Params &params=Params()) FL_NO_EXCEPT
 
fl::string fxName () const FL_NO_EXCEPT override
 
- Public Member Functions inherited from fl::FlowField
 ~FlowField () FL_NO_EXCEPT override=default
 
void draw (DrawContext context) FL_NO_EXCEPT override
 Handles timing, then delegates to drawImpl().
 
const Params & getParams () const FL_NO_EXCEPT
 
Params & getParams () FL_NO_EXCEPT
 
const NoiseBias2D & noiseBias () const FL_NO_EXCEPT
 
NoiseBias2D & noiseBias () FL_NO_EXCEPT
 
void noisePunch (float amplitude=1.0f, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
 Trigger a noise punch on both axes at center with proportional width.
 
void noisePunchX (float center, float width, float amplitude=1.0f, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
 Trigger a noise punch on the X axis (columns).
 
void noisePunchY (float center, float width, float amplitude=1.0f, BumpShape shape=BumpShape::HalfSine) FL_NO_EXCEPT
 Trigger a noise punch on the Y axis (rows).
 
void setColorShift (float speed) FL_NO_EXCEPT
 
void setDotCount (int count) FL_NO_EXCEPT
 
void setEmitterMode (int mode) FL_NO_EXCEPT
 
void setEndpointSpeed (float speed) FL_NO_EXCEPT
 
void setFlowAmplitudeX (float amp) FL_NO_EXCEPT
 
void setFlowAmplitudeY (float amp) FL_NO_EXCEPT
 
void setFlowShift (float shift) FL_NO_EXCEPT
 
void setFlowSpeedX (float speed) FL_NO_EXCEPT
 
void setFlowSpeedY (float speed) FL_NO_EXCEPT
 
void setNoiseFrequency (float freq) FL_NO_EXCEPT
 
void setNoiseFrequencyX (float freq) FL_NO_EXCEPT
 
void setNoiseFrequencyY (float freq) FL_NO_EXCEPT
 
void setPersistence (float halfLife) FL_NO_EXCEPT
 
void setReverseXProfile (bool rev) FL_NO_EXCEPT
 
void setShowFlowVectors (bool show) FL_NO_EXCEPT
 
void setSpeed (float speed) FL_NO_EXCEPT
 Set time speed/scale (1.0 = normal, 0.5 = half speed, etc.)
 
float speed () const FL_NO_EXCEPT
 
- Public Member Functions inherited from fl::Fx2d
 Fx2d (const XYMap &xyMap) FL_NO_EXCEPT
 
u16 getHeight () const FL_NO_EXCEPT
 
u16 getWidth () const FL_NO_EXCEPT
 
const XYMap & getXYMap () const FL_NO_EXCEPT
 
XYMap & getXYMap () FL_NO_EXCEPT
 
void setXYMap (const XYMap &xyMap) FL_NO_EXCEPT
 
u16 xyMap (u16 x, u16 y) const FL_NO_EXCEPT
 
- Public Member Functions inherited from fl::Fx
 Fx (u16 numLeds) FL_NO_EXCEPT
 
u16 getNumLeds () const FL_NO_EXCEPT
 
virtual bool hasFixedFrameRate (float *fps) const FL_NO_EXCEPT
 
virtual void pause (fl::u32 now) FL_NO_EXCEPT
 
virtual void resume (fl::u32 now) FL_NO_EXCEPT
 

Protected Member Functions

void drawImpl (DrawContext context, u32 dt_ms, u32 t_ms) FL_NO_EXCEPT override
 Subclasses implement rendering given the time delta and total time.
 
- Protected Member Functions inherited from fl::FlowField
 FlowField (const XYMap &xyMap, const Params &params=Params()) FL_NO_EXCEPT
 
- Protected Member Functions inherited from fl::Fx
virtual ~Fx () FL_NO_EXCEPT
 

Private Member Functions

void drawAALine (s16x16 x0, s16x16 y0, s16x16 x1, s16x16 y1, s16x16 t, s16x16 colorShift) FL_NO_EXCEPT
 
void drawDot (s16x16 cx, s16x16 cy, s16x16 diam, u8 cr, u8 cg, u8 cb) FL_NO_EXCEPT
 
void drawFlowVectors (fl::span< CRGB > leds) FL_NO_EXCEPT
 
void emitLissajousLine (s16x16 t) FL_NO_EXCEPT
 
void emitOrbitalDots (s16x16 t) FL_NO_EXCEPT
 
void flowAdvect (i32 dt_raw) FL_NO_EXCEPT
 
void flowPrepare (s16x16 t) FL_NO_EXCEPT
 
int idx (int y, int x) const FL_NO_EXCEPT
 
void syncParams () FL_NO_EXCEPT
 

Static Private Member Functions

static i32 clamp_q16 (i32 v, i32 lo, i32 hi) FL_NO_EXCEPT
 
static void initPerm256 (u8 *perm, u32 seed) FL_NO_EXCEPT
 
static u8 q16_to_u8 (i32 v) FL_NO_EXCEPT
 
static CRGB rainbow (s16x16 t, s16x16 speed, s16x16 phase) FL_NO_EXCEPT
 

Private Attributes

s16x16 mColorShift_fp
 
s16x16 mEndpointSpeed_fp
 
s16x16 mFlowAmpX_fp
 
s16x16 mFlowAmpY_fp
 
s16x16 mFlowShift_fp
 
s16x16 mFlowSpeedX_fp
 
s16x16 mFlowSpeedY_fp
 
s16x16 mNoiseFreqX_fp
 
s16x16 mNoiseFreqY_fp
 
u8 mPermX [256] = {}
 
u8 mPermY [256] = {}
 
s16x16 mPersistence_fp
 
FlowFieldFPState mState
 

Friends

struct FlowFieldFPProfiler
 

Additional Inherited Members

- Public Types inherited from fl::FlowField
using Params = FlowFieldParams
 
- Public Types inherited from fl::Fx
using DrawContext = ::fl::DrawContext
 
- Protected Attributes inherited from fl::FlowField
NoiseBias2D mNoiseBias
 
Params mParams
 
- Protected Attributes inherited from fl::Fx2d
XYMap mXyMap
 
- Protected Attributes inherited from fl::Fx
u16 mNumLeds
 

The documentation for this class was generated from the following files: