Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
noise.qh File Reference
#include "random.qh"
Include dependency graph for noise.qh:
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
ERASEABLE float Noise_Pink (entity e, float dt)
ERASEABLE float Noise_White (entity e, float dt)

Function Documentation

◆ classfield()

classfield ( Noise )

References ERASEABLE.

◆ entityclass()

entityclass ( Noise )

◆ Noise_Brown()

ERASEABLE float Noise_Brown ( entity e,
float dt )

Definition at line 14 of file noise.qh.

15{
16 e.noise_baccum += random() * sqrt(dt); // same stddev for all dt
17 return e.noise_baccum;
18}
float random(void)
float sqrt(float f)

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

◆ Noise_Burst()

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

+1 or -1

Definition at line 36 of file noise.qh.

37{
38 if (random() > (p ** dt))
39 e.noise_bstate = !e.noise_bstate;
40 return 2 * e.noise_bstate - 1;
41}

References entity(), and random().

◆ Noise_Pink()

ERASEABLE float Noise_Pink ( entity e,
float dt )

Definition at line 20 of file noise.qh.

21{
22 float f = dt * 60;
23 // http://home.earthlink.net/~ltrammell/tech/pinkalg.htm
24 if (random() > (0.3190 ** f)) e.noise_paccum = 0.34848 * crandom();
25 if (random() > (0.7756 ** f)) e.noise_paccum2 = 0.28768 * crandom();
26 if (random() > (0.9613 ** f)) e.noise_paccum3 = 0.43488 * crandom();
27 return e.noise_paccum + e.noise_paccum2 + e.noise_paccum3;
28}
#define crandom()
Returns a random number between -1.0 and 1.0.
Definition random.qh:32

References crandom, entity(), and random().

Referenced by View_NightVision().

◆ Noise_White()

ERASEABLE float Noise_White ( entity e,
float dt )

Definition at line 30 of file noise.qh.

31{
32 return random() * 2 - 1;
33}

References entity(), and random().

Referenced by View_NightVision().