TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PrecomputedRandom.h
Go to the documentation of this file.
1 
12 #ifndef G3D_PrecomputedRandom_h
13 #define G3D_PrecomputedRandom_h
14 
15 #include "G3D/platform.h"
16 #include "G3D/Random.h"
17 
18 namespace G3D {
19 
29 class PrecomputedRandom : public Random {
30 public:
35  public:
36  float cosHemiX;
37  float cosHemiY;
38  float cosHemiZ;
39  float uniform;
40  };
41 
43  public:
44  float sphereX;
45  float sphereY;
46  float sphereZ;
48  };
49 
50 protected:
51 
55 
57  int m_modMask;
58 
59  int m_index;
60 
62  bool m_freeData;
63 
64 public:
65 
66  /*
67  \param dataSize Must be a power of 2
68  \param data Will NOT be deleted by the destructor.
69  */
70  PrecomputedRandom(const HemiUniformData* data1, const SphereBitsData* data2, int dataSize, uint32 seed = 0xF018A4D2);
71 
75  PrecomputedRandom(int dataSize, uint32 seed = 0xF018A4D2);
76 
78 
81  virtual uint32 bits();
82 
83  // integer is inherited
84 
86  virtual float uniform(float low, float high);
87 
89  virtual float uniform();
90 
91  // gaussian is inherited
92 
95  virtual void cosHemi(float& x, float& y, float& z);
96 
100  virtual void cosPowHemi(const float k, float& x, float& y, float& z);
101 
102  // hemi is inherited
103 
105  virtual void sphere(float& x, float& y, float& z);
106 };
107 
108 }
109 
110 #endif
PrecomputedRandom(const HemiUniformData *data1, const SphereBitsData *data2, int dataSize, uint32 seed=0xF018A4D2)
Definition: PrecomputedRandom.cpp:46
int m_index
Definition: PrecomputedRandom.h:59
virtual float uniform()
Definition: PrecomputedRandom.cpp:71
Definition: AABox.h:25
const HemiUniformData * m_hemiUniform
Definition: PrecomputedRandom.h:53
~PrecomputedRandom()
Definition: PrecomputedRandom.cpp:58
float sphereY
Definition: PrecomputedRandom.h:45
virtual void cosPowHemi(const float k, float &x, float &y, float &z)
Definition: PrecomputedRandom.cpp:84
int m_modMask
Definition: PrecomputedRandom.h:57
virtual void cosHemi(float &x, float &y, float &z)
Definition: PrecomputedRandom.cpp:77
Definition: PrecomputedRandom.h:34
float sphereX
Definition: PrecomputedRandom.h:44
float cosHemiX
Definition: PrecomputedRandom.h:36
uint32 bits
Definition: PrecomputedRandom.h:47
const SphereBitsData * m_sphereBits
Definition: PrecomputedRandom.h:54
float cosHemiY
Definition: PrecomputedRandom.h:37
G3D::int16 z
Definition: Vector3int16.h:46
float uniform
Definition: PrecomputedRandom.h:39
float sphereZ
Definition: PrecomputedRandom.h:46
G3D::int16 y
Definition: Vector2int16.h:38
Definition: PrecomputedRandom.h:42
float cosHemiZ
Definition: PrecomputedRandom.h:38
Definition: PrecomputedRandom.h:29
virtual uint32 bits()
Definition: PrecomputedRandom.cpp:112
bool m_freeData
Definition: PrecomputedRandom.h:62
virtual void sphere(float &x, float &y, float &z)
Definition: PrecomputedRandom.cpp:118
uint32_t uint32
Definition: g3dmath.h:168
G3D::int16 x
Definition: Vector2int16.h:37
Definition: Random.h:39