FastLED 3.10.6
Loading...
Searching...
No Matches

◆ inoise16() [3/4]

fl::u16 inoise16 ( fl::u32 x,
fl::u32 y,
fl::u32 z )
extern

16-bit, fixed point implementation of Perlin's noise.

See also
inoise16_raw()
Returns
scaled noise value as an unsigned integer, 0-65535
Parameters
xx-axis coordinate on noise map (1D)
yy-axis coordinate on noise map (2D)
zz-axis coordinate on noise map (3D)

Definition at line 478 of file noise.cpp.hpp.

478 {
479 fl::i32 ans = inoise16_raw(x,y,z);
480 ans = ans + 19052L;
481 fl::u32 pan = ans;
482 // pan = (ans * 220L) >> 7. That's the same as:
483 // pan = (ans * 440L) >> 8. And this way avoids a 7X four-byte shift-loop on AVR.
484 // Identical math, except for the highest bit, which we don't care about anyway,
485 // since we're returning the 'middle' 16 out of a 32-bit value anyway.
486 pan *= 440L;
487 return (pan>>8);
488
489 // // return scale16by8(pan,220)<<1;
490 // return ((inoise16_raw(x,y,z)+19052)*220)>>7;
491 // return scale16by8(inoise16_raw(x,y,z)+19052,220)<<1;
492}
int y
Definition simple.h:93
int x
Definition simple.h:92
uint32_t z[NUM_LAYERS]
Definition Fire2023.h:93
fl::i16 inoise16_raw(fl::u32 x, fl::u32 y, fl::u32 z)
16-bit, fixed point implementation of Perlin's noise without scaling.