FastLED 3.9.15
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 628 of file noise.cpp.hpp.

629{
630 // Find the unit cube containing the point
631 fl::u8 X = x>>8;
632
633 // Hash cube corner coordinates
634 fl::u8 A = NOISE_P(X);
635 fl::u8 AA = NOISE_P(A);
636 fl::u8 B = NOISE_P(X+1);
637 fl::u8 BA = NOISE_P(B);
638
639 // Get the relative position of the point in the cube
640 fl::u8 u = x;
641
642 // Get a signed version of the above for the grad function
643 fl::i8 xx = ((fl::u8)(x)>>1) & 0x7F;
644 fl::u8 N = 0x80;
645
646 u = EASE8( u);
647
648 fl::i8 ans = lerp7by8(grad8(NOISE_P(AA), xx), grad8(NOISE_P(BA), xx - N), u);
649
650 return ans;
651}
int x
Definition simple.h:92
unsigned char u8
Definition stdint.h:131
FL_DISABLE_WARNING_PUSH unsigned char * B
signed char i8
Definition stdint.h:130
static fl::i8 grad8(fl::u8 hash, fl::i8 x, fl::i8 y, fl::i8 z)
static fl::i8 lerp7by8(fl::i8 a, fl::i8 b, fract8 frac)
#define NOISE_P(x)
Reads a single byte from the p array.
Definition noise.cpp.hpp:32

References grad8(), lerp7by8(), NOISE_P, and x.

+ Here is the call graph for this function: