FastLED 3.9.3
Loading...
Searching...
No Matches
noise.cpp File Reference

Detailed Description

Functions to generate and fill arrays with noise.

Definition in file noise.cpp.

#include <string.h>
#include "FastLED.h"

Go to the source code of this file.

Macros

#define VARIABLE_LENGTH_ARRAY_NEEDS_EMULATION   0
 
#define VARIABLE_LENGTH_ARRAY(TYPE, NAME, SIZE)   TYPE NAME[SIZE]
 
#define FASTLED_INTERNAL
 Disables pragma messages and warnings.
 
#define P(x)   FL_PGM_READ_BYTE_NEAR(p + x)
 Reads a single byte from the p array.
 

Functions

int16_t inoise16_raw (uint32_t x, uint32_t y, uint32_t z)
 16-bit, fixed point implementation of Perlin's noise without scaling.
 
uint16_t inoise16 (uint32_t x, uint32_t y, uint32_t z)
 16-bit, fixed point implementation of Perlin's noise.
 
int16_t inoise16_raw (uint32_t x, uint32_t y)
 16-bit, fixed point implementation of Perlin's noise without scaling.
 
uint16_t inoise16 (uint32_t x, uint32_t y)
 16-bit, fixed point implementation of Perlin's noise.
 
int16_t inoise16_raw (uint32_t x)
 16-bit, fixed point implementation of Perlin's noise without scaling.
 
uint16_t inoise16 (uint32_t x)
 16-bit, fixed point implementation of Perlin's noise.
 
int8_t inoise8_raw (uint16_t x, uint16_t y, uint16_t z)
 8-bit, fixed point implementation of Perlin's noise without scaling.
 
uint8_t inoise8 (uint16_t x, uint16_t y, uint16_t z)
 8-Bit, fixed point implementation of Perlin's noise.
 
int8_t inoise8_raw (uint16_t x, uint16_t y)
 8-bit, fixed point implementation of Perlin's noise without scaling.
 
uint8_t inoise8 (uint16_t x, uint16_t y)
 8-Bit, fixed point implementation of Perlin's noise.
 
int8_t inoise8_raw (uint16_t x)
 8-bit, fixed point implementation of Perlin's noise without scaling.
 
uint8_t inoise8 (uint16_t x)
 8-Bit, fixed point implementation of Perlin's noise.
 
void fill_raw_noise8 (uint8_t *pData, uint8_t num_points, uint8_t octaves, uint16_t x, int scale, uint16_t time)
 Fill a 1D 8-bit buffer with noise, using inoise8()
 
void fill_raw_noise16into8 (uint8_t *pData, uint8_t num_points, uint8_t octaves, uint32_t x, int scale, uint32_t time)
 Fill a 1D 8-bit buffer with noise, using inoise16()
 
void fill_raw_2dnoise8 (uint8_t *pData, int width, int height, uint8_t octaves, q44 freq44, fract8 amplitude, int skip, uint16_t x, int16_t scalex, uint16_t y, int16_t scaley, uint16_t time)
 Fill a 2D 8-bit buffer with noise, using inoise8()
 
void fill_raw_2dnoise8 (uint8_t *pData, int width, int height, uint8_t octaves, uint16_t x, int scalex, uint16_t y, int scaley, uint16_t time)
 
void fill_raw_2dnoise16 (uint16_t *pData, int width, int height, uint8_t octaves, q88 freq88, fract16 amplitude, int skip, uint32_t x, int32_t scalex, uint32_t y, int32_t scaley, uint32_t time)
 Fill a 2D 16-bit buffer with noise, using inoise16()
 
void fill_raw_2dnoise16into8 (uint8_t *pData, int width, int height, uint8_t octaves, q44 freq44, fract8 amplitude, int skip, uint32_t x, int32_t scalex, uint32_t y, int32_t scaley, uint32_t time)
 Fill a 2D 8-bit buffer with noise, using inoise16()
 
void fill_raw_2dnoise16into8 (uint8_t *pData, int width, int height, uint8_t octaves, uint32_t x, int scalex, uint32_t y, int scaley, uint32_t time)
 
void fill_noise8 (CRGB *leds, int num_leds, uint8_t octaves, uint16_t x, int scale, uint8_t hue_octaves, uint16_t hue_x, int hue_scale, uint16_t time)
 Fill an LED array with random colors, using 8-bit noise.
 
void fill_noise16 (CRGB *leds, int num_leds, uint8_t octaves, uint16_t x, int scale, uint8_t hue_octaves, uint16_t hue_x, int hue_scale, uint16_t time, uint8_t hue_shift)
 Fill an LED array with random colors, using 16-bit noise.
 
void fill_2dnoise8 (CRGB *leds, int width, int height, bool serpentine, uint8_t octaves, uint16_t x, int xscale, uint16_t y, int yscale, uint16_t time, uint8_t hue_octaves, uint16_t hue_x, int hue_xscale, uint16_t hue_y, uint16_t hue_yscale, uint16_t hue_time, bool blend)
 Fill an LED matrix with random colors, using 8-bit noise.
 
void fill_2dnoise16 (CRGB *leds, int width, int height, bool serpentine, uint8_t octaves, uint32_t x, int xscale, uint32_t y, int yscale, uint32_t time, uint8_t hue_octaves, uint16_t hue_x, int hue_xscale, uint16_t hue_y, uint16_t hue_yscale, uint16_t hue_time, bool blend, uint16_t hue_shift)
 Fill an LED matrix with random colors, using 16-bit noise.
 

Variables

int32_t nmin =11111110
 Unused.
 
int32_t nmax =0
 Unused.
 

Macro Definition Documentation

◆ FASTLED_INTERNAL

#define FASTLED_INTERNAL

Disables pragma messages and warnings.

Definition at line 26 of file noise.cpp.

◆ P

#define P ( x)    FL_PGM_READ_BYTE_NEAR(p + x)

Reads a single byte from the p array.

Definition at line 42 of file noise.cpp.

◆ VARIABLE_LENGTH_ARRAY

#define VARIABLE_LENGTH_ARRAY ( TYPE,
NAME,
SIZE )   TYPE NAME[SIZE]

Definition at line 16 of file noise.cpp.

◆ VARIABLE_LENGTH_ARRAY_NEEDS_EMULATION

#define VARIABLE_LENGTH_ARRAY_NEEDS_EMULATION   0

Definition at line 12 of file noise.cpp.

Function Documentation

◆ fill_raw_2dnoise16into8()

void fill_raw_2dnoise16into8 ( uint8_t * pData,
int width,
int height,
uint8_t octaves,
uint32_t x,
int scalex,
uint32_t y,
int scaley,
uint32_t time )

Definition at line 763 of file noise.cpp.

◆ fill_raw_2dnoise8() [1/2]

void fill_raw_2dnoise8 ( uint8_t * pData,
int width,
int height,
uint8_t octaves,
q44 freq44,
fract8 amplitude,
int skip,
uint16_t x,
int16_t scalex,
uint16_t y,
int16_t scaley,
uint16_t time )

Fill a 2D 8-bit buffer with noise, using inoise8()

Parameters
pDatathe array of data to fill with noise values
widththe width of the 2D buffer
heightthe height of the 2D buffer
octavesthe number of octaves to use for noise. More octaves = more noise.
freq44starting octave frequency
amplitudenoise amplitude
skiphow many noise maps to skip over, incremented recursively per octave
xx-axis coordinate on noise map (1D)
scalexthe scale (distance) between x points when filling in noise
yy-axis coordinate on noise map (2D)
scaleythe scale (distance) between y points when filling in noise
timethe time position for the noise field
Todo
Why isn't this declared in the header (noise.h)?

Definition at line 654 of file noise.cpp.

◆ fill_raw_2dnoise8() [2/2]

void fill_raw_2dnoise8 ( uint8_t * pData,
int width,
int height,
uint8_t octaves,
uint16_t x,
int scalex,
uint16_t y,
int scaley,
uint16_t time )

Definition at line 688 of file noise.cpp.

Variable Documentation

◆ nmax

int32_t nmax =0

Unused.

Todo
Remove?

Definition at line 728 of file noise.cpp.

◆ nmin

int32_t nmin =11111110

Unused.

Todo
Remove?

Definition at line 725 of file noise.cpp.