source: GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Halton.cpp @ 2839

Revision 2839, 1.0 KB checked in by mattausch, 16 years ago (diff)
Line 
1#include "common.h"
2#include "Halton.h"
3
4
5float Halton2::_invBases[2];
6
7template<int T> float Halton<T>::_invBases[T];
8 
9Halton<1> dummmyHalton1(true);
10Halton<2> dummmyHalton2(true);
11Halton<3> dummmyHalton3(true);
12Halton<4> dummmyHalton4(true);
13Halton<5> dummmyHalton5(true);
14Halton<6> dummmyHalton6(true);
15
16
17int HaltonSequence::sPregeneratedDim = 0;
18int HaltonSequence::sPregeneratedNumber = 0;
19float *HaltonSequence::sPregeneratedValues = NULL;
20
21
22// special construtor for pregenerating static halton sequences
23HaltonSequence::HaltonSequence(const int dim, const int number)
24{
25
26        sPregeneratedDim = 0;
27        sPregeneratedNumber = 0;
28        sPregeneratedValues = new float[number*dim];
29
30        float *p = sPregeneratedValues;
31
32        for (int i=0; i < number; i++, p+=dim)
33        {
34                GetNext(dim, p);
35        }
36
37        sPregeneratedDim = dim;
38        sPregeneratedNumber = number;
39}
40
41
42void HaltonSequence::GetNext(const int dimensions, float *p)
43{
44        for (int i = 0; i < dimensions; ++ i)
45                p[i] = (float)GetNumber(i + 1);
46
47        GenerateNext();
48}
Note: See TracBrowser for help on using the repository browser.