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

◆ inoise8_raw() [1/3]

int8_t inoise8_raw ( uint16_t 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 623 of file noise.cpp.

624{
625 // Find the unit cube containing the point
626 uint8_t X = x>>8;
627
628 // Hash cube corner coordinates
629 uint8_t A = NOISE_P(X);
630 uint8_t AA = NOISE_P(A);
631 uint8_t B = NOISE_P(X+1);
632 uint8_t BA = NOISE_P(B);
633
634 // Get the relative position of the point in the cube
635 uint8_t u = x;
636
637 // Get a signed version of the above for the grad function
638 int8_t xx = ((uint8_t)(x)>>1) & 0x7F;
639 uint8_t N = 0x80;
640
641 u = EASE8( u);
642
643 int8_t ans = lerp7by8(grad8(NOISE_P(AA), xx), grad8(NOISE_P(BA), xx - N), u);
644
645 return ans;
646}
int x
Definition simple.h:92
static int8_t grad8(uint8_t hash, int8_t x, int8_t y, int8_t z)
Definition noise.cpp:187
static int8_t lerp7by8(int8_t a, int8_t b, fract8 frac)
Definition noise.cpp:278
#define NOISE_P(x)
Reads a single byte from the p array.
Definition noise.cpp:26

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

+ Here is the call graph for this function: