Xonotic
noise.qh File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 classfield (Noise).float noise_baccum
 
 entityclass (Noise)
 
ERASEABLE float Noise_Brown (entity e, float dt)
 
ERASEABLE float Noise_Burst (entity e, float dt, float p)
 +1 or -1 More...
 
ERASEABLE float Noise_Pink (entity e, float dt)
 
ERASEABLE float Noise_White (entity e, float dt)
 

Function Documentation

◆ classfield()

classfield ( Noise  )

◆ entityclass()

entityclass ( Noise  )

◆ Noise_Brown()

ERASEABLE float Noise_Brown ( entity  e,
float  dt 
)

Definition at line 12 of file noise.qh.

References ERASEABLE, random(), and sqrt().

13 {
14  e.noise_baccum += random() * sqrt(dt); // same stddev for all dt
15  return e.noise_baccum;
16 }
+ Here is the call graph for this function:

◆ Noise_Burst()

ERASEABLE float Noise_Burst ( entity  e,
float  dt,
float  p 
)

+1 or -1

Definition at line 35 of file noise.qh.

References random().

36 {
37  if (random() > (p ** dt)) e.noise_bstate = !e.noise_bstate;
38  return 2 * e.noise_bstate - 1;
39 }
+ Here is the call graph for this function:

◆ Noise_Pink()

ERASEABLE float Noise_Pink ( entity  e,
float  dt 
)

Definition at line 18 of file noise.qh.

References ERASEABLE, and random().

Referenced by View_NightVision().

19 {
20  float f;
21  f = dt * 60;
22  // http://home.earthlink.net/~ltrammell/tech/pinkalg.htm
23  if (random() > (0.3190 ** f)) e.noise_paccum = 0.34848 * (2 * random() - 1);
24  if (random() > (0.7756 ** f)) e.noise_paccum2 = 0.28768 * (2 * random() - 1);
25  if (random() > (0.9613 ** f)) e.noise_paccum3 = 0.43488 * (2 * random() - 1);
26  return e.noise_paccum + e.noise_paccum2 + e.noise_paccum3;
27 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Noise_White()

ERASEABLE float Noise_White ( entity  e,
float  dt 
)

Definition at line 29 of file noise.qh.

References ERASEABLE, and random().

Referenced by View_NightVision().

30 {
31  return random() * 2 - 1;
32 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function: