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

◆ fill_raw_2dnoise16()

void fill_raw_2dnoise16 ( fl::u16 * pData,
int width,
int height,
fl::u8 octaves,
fl::q88 freq88,
fract16 amplitude,
int skip,
fl::u32 x,
fl::i32 scalex,
fl::u32 y,
fl::i32 scaley,
fl::u32 time )

Fill a 2D 16-bit buffer with noise, using inoise16()

Parameters
freq88starting octave frequency
amplitudenoise amplitude
skiphow many noise maps to skip over, incremented recursively per octave

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

756 {
757 if(octaves > 1) {
758 fill_raw_2dnoise16(pData, width, height, octaves-1, freq88, amplitude, skip, x *freq88 , scalex *freq88, y * freq88, scaley * freq88, time);
759 } else {
760 // amplitude is always 255 on the lowest level
761 amplitude=65535;
762 }
763
764 scalex *= skip;
765 scaley *= skip;
766 fract16 invamp = 65535-amplitude;
767 for(int i = 0; i < height; i+=skip, y+=scaley) {
768 fl::u16 *pRow = pData + (i*width);
769 for(int j = 0,xx=x; j < width; j+=skip, xx+=scalex) {
770 fl::u16 noise_base = inoise16(xx,y,time);
771 noise_base = (0x8000 & noise_base) ? noise_base - (32767) : 32767 - noise_base;
772 noise_base = scale16(noise_base<<1, amplitude);
773 if(skip==1) {
774 pRow[j] = scale16(pRow[j],invamp) + noise_base;
775 } else {
776 for(int ii = i; ii<(i+skip) && ii<height; ++ii) {
777 fl::u16 *pRow = pData + (ii*width);
778 for(int jj=j; jj<(j+skip) && jj<width; ++jj) {
779 pRow[jj] = scale16(pRow[jj],invamp) + noise_base;
780 }
781 }
782 }
783 }
784 }
785}
int y
Definition simple.h:93
int x
Definition simple.h:92
uint8_t octaves
void fill_raw_2dnoise16(fl::u16 *pData, int width, int height, fl::u8 octaves, fl::q88 freq88, fract16 amplitude, int skip, fl::u32 x, fl::i32 scalex, fl::u32 y, fl::i32 scaley, fl::u32 time)
Fill a 2D 16-bit buffer with noise, using inoise16()
fl::u16 inoise16(fl::u32 x, fl::u32 y, fl::u32 z, fl::u32 t)
u16 fract16
ANSI: unsigned _Fract.
Definition s16x16x4.h:171
u8 u8 height
Definition blur.h:186
u8 width
Definition blur.h:186

References fill_raw_2dnoise16(), inoise16(), octaves, x, and y.

Referenced by fill_raw_2dnoise16().

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