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

◆ inoise8_raw() [2/3]

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

Parameters
yy-axis coordinate on noise map (2D)

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

584{
585 // Find the unit cube containing the point
586 fl::u8 X = x>>8;
587 fl::u8 Y = y>>8;
588
589 // Hash cube corner coordinates
590 fl::u8 A = NOISE_P(X)+Y;
591 fl::u8 AA = NOISE_P(A);
592 fl::u8 AB = NOISE_P(A+1);
593 fl::u8 B = NOISE_P(X+1)+Y;
594 fl::u8 BA = NOISE_P(B);
595 fl::u8 BB = NOISE_P(B+1);
596
597 // Get the relative position of the point in the cube
598 fl::u8 u = x;
599 fl::u8 v = y;
600
601 // Get a signed version of the above for the grad function
602 fl::i8 xx = ((fl::u8)(x)>>1) & 0x7F;
603 fl::i8 yy = ((fl::u8)(y)>>1) & 0x7F;
604 fl::u8 N = 0x80;
605
606 u = EASE8(u); v = EASE8(v);
607
608 fl::i8 X1 = lerp7by8(grad8(NOISE_P(AA), xx, yy), grad8(NOISE_P(BA), xx - N, yy), u);
609 fl::i8 X2 = lerp7by8(grad8(NOISE_P(AB), xx, yy-N), grad8(NOISE_P(BB), xx - N, yy - N), u);
610
611 fl::i8 ans = lerp7by8(X1,X2,v);
612
613 return ans;
614 // return scale8((70+(ans)),234)<<1;
615}
int y
Definition simple.h:93
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, x, and y.

+ Here is the call graph for this function: