MCPcopy Create free account
hub / github.com/FastLED/FastLED / fill_raw_2dnoise16

Function fill_raw_2dnoise16

src/noise.cpp.hpp:756–785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

754}
755
756void 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) {
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}
786
787/// Unused
788/// @todo Remove?

Callers

nothing calls this directly

Calls 1

inoise16Function · 0.85

Tested by

no test coverage detected