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

int Fast_rand ( void  )

Definition at line 58 of file 3d_fastmath.cpp.

References s_nextRandSeed.

Referenced by CPOSTSHADER_SSAO::Shade().

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
float Fast_RandFloat ( )

Definition at line 45 of file 3d_fastmath.cpp.

References s_randSeed.

Referenced by CBOARDNORMAL::Generate(), CCOPPERNORMAL::Generate(), CMETALBRUSHEDNORMAL::Generate(), RAYPACKET::RAYPACKET(), RAYPACKET_InitRays_with2DDisplacement(), and UniformRandomHemisphereDirection().

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

Definition at line 65 of file 3d_fastmath.cpp.

References s_nextRandSeed.

66 {
67  s_nextRandSeed = seed;
68 }
static unsigned long int s_nextRandSeed
Definition: 3d_fastmath.cpp:56

Variable Documentation

unsigned long int s_nextRandSeed = 1
static

Definition at line 56 of file 3d_fastmath.cpp.

Referenced by Fast_rand(), and Fast_srand().

int s_randSeed = 1
static

Definition at line 41 of file 3d_fastmath.cpp.

Referenced by Fast_RandFloat().