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

◆ pnoise3d_raw()

fl::i32 fl::perlin_s16x16::pnoise3d_raw ( fl::i32 fx_raw,
fl::i32 fy_raw,
fl::i32 fz_raw,
const fl::i32 * fade_lut,
const fl::u8 * perm )
static

Definition at line 102 of file perlin_s16x16.cpp.hpp.

104 {
105 int X, Y, Z;
106 fl::i32 x, y, z;
107 floor_frac(fx_raw, X, x);
108 floor_frac(fy_raw, Y, y);
109 floor_frac(fz_raw, Z, z);
110 X &= 255;
111 Y &= 255;
112 Z &= 255;
113
114 fl::i32 u = fade(x, fade_lut);
115 fl::i32 v = fade(y, fade_lut);
116 fl::i32 w = fade(z, fade_lut);
117
118 int A = perm[X & 255] + Y;
119 int AA = perm[A & 255] + Z;
120 int AB = perm[(A + 1) & 255] + Z;
121 int B = perm[(X + 1) & 255] + Y;
122 int BA = perm[B & 255] + Z;
123 int BB = perm[(B + 1) & 255] + Z;
124
125 fl::i32 result = lerp(w,
126 lerp(v,
127 lerp(u, grad3d(perm[AA & 255], x, y, z),
128 grad3d(perm[BA & 255], x - HP_ONE, y, z)),
129 lerp(u, grad3d(perm[AB & 255], x, y - HP_ONE, z),
130 grad3d(perm[BB & 255], x - HP_ONE, y - HP_ONE, z))),
131 lerp(v,
132 lerp(u, grad3d(perm[(AA + 1) & 255], x, y, z - HP_ONE),
133 grad3d(perm[(BA + 1) & 255], x - HP_ONE, y, z - HP_ONE)),
134 lerp(u, grad3d(perm[(AB + 1) & 255], x, y - HP_ONE, z - HP_ONE),
135 grad3d(perm[(BB + 1) & 255], x - HP_ONE, y - HP_ONE, z - HP_ONE))));
136
138}
uint32_t z[NUM_LAYERS]
Definition Fire2023.h:93
static constexpr int FRAC_BITS
Definition s16x16.h:22
FL_DISABLE_WARNING_PUSH unsigned char * B
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31
static fl::i32 fade(fl::i32 t, const fl::i32 *table)
static constexpr fl::i32 HP_ONE
static void floor_frac(fl::i32 fp16, int &ifloor, fl::i32 &frac24)
static fl::i32 lerp(fl::i32 t, fl::i32 a, fl::i32 b)
static constexpr int HP_BITS
static fl::i32 grad3d(int hash, fl::i32 x, fl::i32 y, fl::i32 z)

References fl::B, fade(), floor_frac(), fl::s16x16::FRAC_BITS, grad3d(), HP_BITS, HP_ONE, lerp(), fl::x, fl::y, and z.

Referenced by pnoise3d(), and fl::render_value_fp().

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