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

◆ inoise8_raw() [1/3]

fl::i8 inoise8_raw ( fl::u16 x)
extern

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

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

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

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

667 {
668 // Find the unit cube containing the point
669 fl::u8 X = x>>8;
670
671 // Hash cube corner coordinates
672 fl::u8 A = NOISE_P(X);
673 fl::u8 AA = NOISE_P(A);
674 fl::u8 B = NOISE_P(X+1);
675 fl::u8 BA = NOISE_P(B);
676
677 // Get the relative position of the point in the cube
678 fl::u8 u = x;
679
680 // Get a signed version of the above for the grad function
681 fl::i8 xx = ((fl::u8)(x)>>1) & 0x7F;
682 fl::u8 N = 0x80;
683
684 u = EASE8( u);
685
686 fl::i8 ans = lerp7by8(grad8(NOISE_P(AA), xx), grad8(NOISE_P(BA), xx - N), u);
687
688 return ans;
689}
int x
Definition simple.h:92
unsigned char u8
Definition stdint.h:131
signed char i8
Definition stdint.h:130
static fl::i8 lerp7by8(fl::i8 a, fl::i8 b, fract8 frac) FL_NO_EXCEPT
static fl::i8 grad8(fl::u8 hash, fl::i8 x, fl::i8 y, fl::i8 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, grad8(), lerp7by8(), NOISE_P, and x.

+ Here is the call graph for this function: