diff options
Diffstat (limited to 'noise.h')
-rw-r--r-- | noise.h | 96 |
1 files changed, 24 insertions, 72 deletions
@@ -1,66 +1,14 @@ #ifndef __INC_NOISE_H #define __INC_NOISE_H -#if 0 -/// Class for accessing 16 bit noise. Provides methods for setting origin, scale, -/// frequency, alplitude, time, octave blurring -class CFastNoise16 { -public: - CFastNoise16 &setOrigin(uint32_t x, uint32_t y, uint32_t z); - CFastNoise16 &setOrigin(uint32_t x, uint32_t y); - CFastNoise16 &setOrigin(uint32_t x); - - uint32_t getX(); - uint32_t getY(); - uint32_t getZ(); - uint32_t getTime(); - - uint32_t getOrigin(uint32_t & x, uint32_t & y, uint32_t & z); - uint32_t getOrigin(uint32_t & x, uint32_t & y); - uint32_t getOrigin(uint32_t & x); - - CFastNoise16 &advance(int32_t x, int32_t y, int32_t z); - CFastNoise16 &advance(int32_t x, int32_t y; - CFastNoise16 &advance(int32_t x); - - CFastNoise16 &advanceTime(int32_t t); - - CFastNoise16 &setScale(int32_t x_scale, int32_t y_scale, int32_t z_scale); - CFastNoise16 &setScale(int32_t x_scale, int32_t y_scale); - CFastNoise16 &setScale(int32_t x_scale); - - int32_t getScaleX(); - int32_t getScaleY(); - int32_t getScaleZ(); - void getScale(int32_t & x, int32_t & y, int32_t & z); - void getScale(int32_t & x, int32_t & y); - void getScale(int32_t & x); - - CFastNoise16 &setAmplitude(fract16 amplitude); - - CFastNoise16 &setFrequency(q88 frequency); - CFastNoise16 &setTime(uint32_t time); - - CFastNoise16 &setOctaves(int octaves); - - CFastNoise16 &setOctaveBlur(bool blurOctaves); - - void getNoise(uint32_t x, uint32_t y, uint32_t z); - void getNoise(uint32_t x, uint32_t y); - void getNoise(uint32_t x); - - void fillNoise(uint16_t *pData, int size); - void fillNoise(uint16_t *pData, int width, int height); - void fillNoise(uint16_t *pData, int width, int height, int depth); - - void fillNoise(uint8_t *pData, int size); - void fillNoise(uint8_t *pData, int width, int height); - void fillNoise(uint8_t *pData, int width, int height, int depth); -}; -#endif +///@file noise.h +/// Noise functions provided by the library. +///@defgroup Noise Noise functions +///Simplex noise function definitions +///@{ /// @name scaled 16 bit noise functions -//@{ +///@{ /// 16 bit, fixed point implementation of perlin's Simplex Noise. Coordinates are /// 16.16 fixed point values, 32 bit integers with integral coordinates in the high 16 /// bits and fractional in the low 16 bits, and the function takes 1d, 2d, and 3d coordinate @@ -69,7 +17,7 @@ public: extern uint16_t inoise16(uint32_t x, uint32_t y, uint32_t z); extern uint16_t inoise16(uint32_t x, uint32_t y); extern uint16_t inoise16(uint32_t x); -//@} +///@} /// @name raw 16 bit noise functions //@{ @@ -78,10 +26,10 @@ extern uint16_t inoise16(uint32_t x); extern int16_t inoise16_raw(uint32_t x, uint32_t y, uint32_t z); extern int16_t inoise16_raw(uint32_t x, uint32_t y); extern int16_t inoise16_raw(uint32_t x); -//@} +///@} /// @name 8 bit scaled noise functions -//@{ +///@{ /// 8 bit, fixed point implementation of perlin's Simplex Noise. Coordinates are /// 8.8 fixed point values, 16 bit integers with integral coordinates in the high 8 /// bits and fractional in the low 8 bits, and the function takes 1d, 2d, and 3d coordinate @@ -89,27 +37,27 @@ extern int16_t inoise16_raw(uint32_t x); extern uint8_t inoise8(uint16_t x, uint16_t y, uint16_t z); extern uint8_t inoise8(uint16_t x, uint16_t y); extern uint8_t inoise8(uint16_t x); -//@} +///@} /// @name 8 bit raw noise functions -//@{ -// 8 bit raw versions of the noise functions. These values are not scaled/altered and have -// output values roughly in the range (-70,70) +///@{ +/// 8 bit raw versions of the noise functions. These values are not scaled/altered and have +/// output values roughly in the range (-70,70) extern int8_t inoise8_raw(uint16_t x, uint16_t y, uint16_t z); extern int8_t inoise8_raw(uint16_t x, uint16_t y); extern int8_t inoise8_raw(uint16_t x); -//@} +///@} -///@name fill functions -//@{ +///@name raw fill functions +///@{ /// Raw noise fill functions - fill into a 1d or 2d array of 8-bit values using either 8-bit noise or 16-bit noise /// functions. -///@param pData the array of data to write into +///@param pData the array of data to write into ///@param num_points the number of points of noise to compute ///@param octaves the number of octaves to use for noise ///@param x the x position in the noise field ///@param y the y position in the noise field for 2d functions -///@param scalex the scale (distance) between x points when filling in noise +///@param scalex the scale (distance) between x points when filling in noise ///@param scaley the scale (distance) between y points when filling in noise ///@param time the time position for the noise field void fill_raw_noise8(uint8_t *pData, uint8_t num_points, uint8_t octaves, uint16_t x, int scalex, uint16_t time); @@ -119,9 +67,11 @@ void fill_raw_2dnoise16into8(uint8_t *pData, int width, int height, uint8_t octa void fill_raw_2dnoise16(uint16_t *pData, int width, int height, uint8_t octaves, q88 freq88, fract16 amplitude, int skip, uint32_t x, int scalex, uint32_t y, int scaley, uint32_t time); void fill_raw_2dnoise16into8(uint8_t *pData, int width, int height, uint8_t octaves, q44 freq44, fract8 amplitude, int skip, uint32_t x, int scalex, uint32_t y, int scaley, uint32_t time); -//@} +///@} -// fill functions to fill leds with values based on noise functions. These functions use the fill_raw_* functions as appropriate. +///@name fill functions +///@{ +/// fill functions to fill leds with values based on noise functions. These functions use the fill_raw_* functions as appropriate. 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, @@ -137,4 +87,6 @@ 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=0); +///@} + #endif |