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

◆ inoise8_raw() [3/3]

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

Parameters
zz-axis coordinate on noise map (3D)

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

535{
536 // Find the unit cube containing the point
537 fl::u8 X = x>>8;
538 fl::u8 Y = y>>8;
539 fl::u8 Z = z>>8;
540
541 // Hash cube corner coordinates
542 fl::u8 A = NOISE_P(X)+Y;
543 fl::u8 AA = NOISE_P(A)+Z;
544 fl::u8 AB = NOISE_P(A+1)+Z;
545 fl::u8 B = NOISE_P(X+1)+Y;
546 fl::u8 BA = NOISE_P(B) + Z;
547 fl::u8 BB = NOISE_P(B+1)+Z;
548
549 // Get the relative position of the point in the cube
550 fl::u8 u = x;
551 fl::u8 v = y;
552 fl::u8 w = z;
553
554 // Get a signed version of the above for the grad function
555 fl::i8 xx = ((fl::u8)(x)>>1) & 0x7F;
556 fl::i8 yy = ((fl::u8)(y)>>1) & 0x7F;
557 fl::i8 zz = ((fl::u8)(z)>>1) & 0x7F;
558 fl::u8 N = 0x80;
559
560 u = EASE8(u); v = EASE8(v); w = EASE8(w);
561
562 fl::i8 X1 = lerp7by8(grad8(NOISE_P(AA), xx, yy, zz), grad8(NOISE_P(BA), xx - N, yy, zz), u);
563 fl::i8 X2 = lerp7by8(grad8(NOISE_P(AB), xx, yy-N, zz), grad8(NOISE_P(BB), xx - N, yy - N, zz), u);
564 fl::i8 X3 = lerp7by8(grad8(NOISE_P(AA+1), xx, yy, zz-N), grad8(NOISE_P(BA+1), xx - N, yy, zz-N), u);
565 fl::i8 X4 = lerp7by8(grad8(NOISE_P(AB+1), xx, yy-N, zz-N), grad8(NOISE_P(BB+1), xx - N, yy - N, zz - N), u);
566
567 fl::i8 Y1 = lerp7by8(X1,X2,v);
568 fl::i8 Y2 = lerp7by8(X3,X4,v);
569
570 fl::i8 ans = lerp7by8(Y1,Y2,w);
571
572 return ans;
573}
int y
Definition simple.h:93
int x
Definition simple.h:92
uint32_t z[NUM_LAYERS]
Definition Fire2023.h:93
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, y, and z.

Referenced by inoise8(), inoise8(), and inoise8().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: