FastLED 3.10.8
Loading...
Searching...
No Matches

◆ inoise16_raw() [1/4]

fl::i16 inoise16_raw ( fl::u32 x)
extern

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

Coordinates are 16.16 fixed point values, 32 bit integers with integral coordinates in the high 16-bits and fractional in the low 16-bits.

Returns
unscaled noise value as a signed integer, roughly -18k to 18k
Parameters
xx-axis coordinate on noise map (1D)

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

544 {
545 // Find the unit cube containing the point
546 fl::u8 X = x>>16;
547
548 // Hash cube corner coordinates
549 fl::u8 A = NOISE_P(X);
550 fl::u8 AA = NOISE_P(A);
551 fl::u8 B = NOISE_P(X+1);
552 fl::u8 BA = NOISE_P(B);
553
554 // Get the relative position of the point in the cube
555 fl::u16 u = x & 0xFFFF;
556
557 // Get a signed version of the above for the grad function
558 fl::i16 xx = (u >> 1) & 0x7FFF;
559 fl::u16 N = 0x8000L;
560
561 u = EASE16(u);
562
563 fl::i16 ans = LERP(grad16(NOISE_P(AA), xx), grad16(NOISE_P(BA), xx - N), u);
564
565 return ans;
566}
int x
Definition simple.h:92
unsigned char u8
Definition stdint.h:131
static fl::i16 grad16(fl::u8 hash, fl::i16 x, fl::i16 y, fl::i16 z) FL_NO_EXCEPT
#define NOISE_P(x)
Reads a single byte from the p array.
Definition noise.cpp.hpp:33

References FL_NO_EXCEPT, grad16(), NOISE_P, and x.

+ Here is the call graph for this function: