FFmpeg
Data Structures | Enumerations | Functions
perlin.h File Reference
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  FFPerlin
 Perlin generator context. More...
 

Enumerations

enum  FFPerlinRandomMode { FF_PERLIN_RANDOM_MODE_RANDOM, FF_PERLIN_RANDOM_MODE_KEN, FF_PERLIN_RANDOM_MODE_SEED, FF_PERLIN_RANDOM_MODE_NB }
 

Functions

int ff_perlin_init (FFPerlin *perlin, double period, int octaves, double persistence, enum FFPerlinRandomMode random_mode, unsigned int random_seed)
 Initialize the Perlin noise generator with parameters. More...
 
double ff_perlin_get (FFPerlin *perlin, double x, double y, double z)
 Compute Perlin noise given the x, y, z coordinates. More...
 

Detailed Description

Perlin Noise generator

Definition in file perlin.h.

Enumeration Type Documentation

◆ FFPerlinRandomMode

Enumerator
FF_PERLIN_RANDOM_MODE_RANDOM 
FF_PERLIN_RANDOM_MODE_KEN 
FF_PERLIN_RANDOM_MODE_SEED 
FF_PERLIN_RANDOM_MODE_NB 

Definition at line 31 of file perlin.h.

Function Documentation

◆ ff_perlin_init()

int ff_perlin_init ( FFPerlin perlin,
double  period,
int  octaves,
double  persistence,
enum FFPerlinRandomMode  random_mode,
unsigned int  random_seed 
)

Initialize the Perlin noise generator with parameters.

Parameters
perlinPerlin noise generator context
periodspatial repeat period, if negative it is ignored
octavestotal number of components making up the noise, each one with doubled frequency
persistencedefine ratio used to compute the amplitude of the next octave component with respect to the previous component
random_modedefine how to compute the permutations array
random_seedwhen random_mode is set to FF_PERLIN_RANDOM_MODE_RANDOM, set random seed used to compute the permutations array
Returns
a negative AVERROR code in case of error, a non negative value otherwise

Definition at line 101 of file perlin.c.

Referenced by init().

◆ ff_perlin_get()

double ff_perlin_get ( FFPerlin perlin,
double  x,
double  y,
double  z 
)

Compute Perlin noise given the x, y, z coordinates.

Parameters
perlinPerlin noise generator context
Returns
normalized value for the perlin noise, in the range [0, 1]

Definition at line 208 of file perlin.c.

Referenced by request_frame().