KiCad PCB EDA Suite
3d_fastmath.cpp File Reference
#include "3d_fastmath.h"

Go to the source code of this file.

Functions

float Fast_RandFloat ()
 
int Fast_rand (void)
 
void Fast_srand (unsigned int seed)
 

Variables

static int s_randSeed = 1
 
static unsigned long int s_nextRandSeed = 1
 

Function Documentation

◆ Fast_rand()

int Fast_rand ( void  )

Definition at line 58 of file 3d_fastmath.cpp.

59{
60 s_nextRandSeed = s_nextRandSeed * 1103515245 + 12345;
61
62 return (unsigned int)(s_nextRandSeed >> 16) & 0x7FFF;
63}
static unsigned long int s_nextRandSeed
Definition: 3d_fastmath.cpp:56

References s_nextRandSeed.

Referenced by POST_SHADER_SSAO::Shade().

◆ Fast_RandFloat()

float Fast_RandFloat ( )

Definition at line 45 of file 3d_fastmath.cpp.

46{
47 s_randSeed *= 16807;
48
49 return (float)s_randSeed * 4.6566129e-010f;
50}
static int s_randSeed
Definition: 3d_fastmath.cpp:41

References s_randSeed.

Referenced by RAYPACKET::RAYPACKET(), RAYPACKET_InitRays_with2DDisplacement(), and UniformRandomHemisphereDirection().

◆ Fast_srand()

void Fast_srand ( unsigned int  seed)

Definition at line 65 of file 3d_fastmath.cpp.

66{
67 s_nextRandSeed = seed;
68}

References s_nextRandSeed.

Variable Documentation

◆ s_nextRandSeed

unsigned long int s_nextRandSeed = 1
static

Definition at line 56 of file 3d_fastmath.cpp.

Referenced by Fast_rand(), and Fast_srand().

◆ s_randSeed

int s_randSeed = 1
static

Definition at line 41 of file 3d_fastmath.cpp.

Referenced by Fast_RandFloat().