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 669 of file noise.cpp.

670{
671 // Find the unit cube containing the point
672 uint8_t X = x>>8;
673
674 // Hash cube corner coordinates
675 uint8_t A = P(X);
676 uint8_t AA = P(A);
677 uint8_t B = P(X+1);
678 uint8_t BA = P(B);
679
680 // Get the relative position of the point in the cube
681 uint8_t u = x;
682
683 // Get a signed version of the above for the grad function
684 int8_t xx = ((uint8_t)(x)>>1) & 0x7F;
685 uint8_t N = 0x80;
686
687 u = EASE8( u);
688
689 int8_t ans = lerp7by8(grad8(P(AA), xx), grad8(P(BA), xx - N), u);
690
691 return ans;
692}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
static int8_t grad8(uint8_t hash, int8_t x, int8_t y, int8_t z)
Definition noise.cpp:209
#define P(x)
Reads a single byte from the p array.
Definition noise.cpp:51
static int8_t lerp7by8(int8_t a, int8_t b, fract8 frac)
Definition noise.cpp:324

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

+ Here is the call graph for this function: