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

◆ pnoise2d_raw()

fl::i32 fl::perlin_q16::pnoise2d_raw ( fl::i32 fx_raw,
fl::i32 fy_raw,
const fl::i32 * fade_lut,
const fl::u8 * perm )
static

Definition at line 34 of file perlin_q16.cpp.hpp.

36 {
37 int X, Y;
38 fl::i32 x, y;
39 floor_frac(fx_raw, X, x);
40 floor_frac(fy_raw, Y, y);
41 X &= 255;
42 Y &= 255;
43
44 fl::i32 u = fade(x, fade_lut);
45 fl::i32 v = fade(y, fade_lut);
46
47 int A = perm[X & 255] + Y;
48 int AA = perm[A & 255];
49 int AB = perm[(A + 1) & 255];
50 int B = perm[(X + 1) & 255] + Y;
51 int BA = perm[B & 255];
52 int BB = perm[(B + 1) & 255];
53
54 fl::i32 result = lerp(v,
55 lerp(u, grad(perm[AA & 255], x, y),
56 grad(perm[BA & 255], x - HP_ONE, y)),
57 lerp(u, grad(perm[AB & 255], x, y - HP_ONE),
58 grad(perm[BB & 255], x - HP_ONE, y - HP_ONE)));
59
60 // No shift needed: already in Q16 format, matches s16x16::FRAC_BITS
61 return result;
62}
FL_DISABLE_WARNING_PUSH unsigned char * B
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
static FASTLED_FORCE_INLINE fl::i32 grad(int hash, fl::i32 x, fl::i32 y)
static FASTLED_FORCE_INLINE fl::i32 lerp(fl::i32 t, fl::i32 a, fl::i32 b)
static FASTLED_FORCE_INLINE fl::i32 fade(fl::i32 t, const fl::i32 *table)
static constexpr fl::i32 HP_ONE
Definition perlin_q16.h:16
static FASTLED_FORCE_INLINE void floor_frac(fl::i32 fp16, int &ifloor, fl::i32 &frac16)

References fl::B, fade(), floor_frac(), grad(), HP_ONE, lerp(), fl::x, and fl::y.

Referenced by pnoise2d().

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