51 return cmj_hash(i, p) * (1.0f / 4294967808.0f);
59 points[0].
x = g.
rnd();
60 points[0].
y = g.
rnd();
82 for (
int s = 0; s < NN; ++s) {
85 for (
int s = 0; s <
N; ++s) {
86 int xstratum = (int)(NN * points[s].
x);
87 int ystratum = (int)(NN * points[s].
y);
94 float2 points[],
float i,
float j,
float xhalf,
float yhalf,
int n,
int N)
98 int xstratum, ystratum;
100 pt.
x = (i + 0.5f * (xhalf +
rnd())) / n;
101 xstratum = (int)(NN * pt.
x);
104 pt.
y = (j + 0.5f * (yhalf +
rnd())) / n;
105 ystratum = (int)(NN * pt.
y);
119 for (
int s = 0; s <
N; ++s) {
123 float xhalf =
floorf(2.0f * (n * oldpt.
x - i));
124 float yhalf =
floorf(2.0f * (n * oldpt.
y - j));
125 xhalf = 1.0f - xhalf;
126 yhalf = 1.0f - yhalf;
133 int n = (int)
sqrtf(
N / 2);
137 std::vector<float> xhalves(
N / 2);
138 std::vector<float> yhalves(
N / 2);
139 for (
int s = 0; s <
N / 2; ++s) {
143 float xhalf =
floorf(2.0f * (n * oldpt.
x - i));
144 float yhalf =
floorf(2.0f * (n * oldpt.
y - j));
146 xhalf = 1.0f - xhalf;
149 yhalf = 1.0f - yhalf;
155 for (
int s = 0; s <
N / 2; ++s) {
159 float xhalf = 1.0f - xhalves[s];
160 float yhalf = 1.0f - yhalves[s];
173 float2 points[],
float i,
float j,
float xhalf,
float yhalf,
int n,
int N)
override
178 pt.
x = (i + 0.5f * (xhalf +
rnd())) / n;
179 pt.
y = (j + 0.5f * (yhalf +
rnd())) / n;
189 int num_shapes = (int)log2f(NN) + 1;
190 occupiedStrata.resize(num_shapes);
191 for (
int shape = 0; shape < num_shapes; ++shape) {
192 occupiedStrata[shape].resize(NN);
193 for (
int n = 0; n < NN; ++n) {
194 occupiedStrata[shape][n] =
false;
197 for (
int s = 0; s <
N; ++s) {
208 int xstratum = (int)(xdivs * pt.
x);
209 int ystratum = (int)(ydivs * pt.
y);
210 size_t index = ystratum * xdivs + xstratum;
212 occupiedStrata[shape][index] =
true;
225 int xstratum = (int)(xdivs * pt.
x);
226 int ystratum = (int)(ydivs * pt.
y);
227 size_t index = ystratum * xdivs + xstratum;
229 if (occupiedStrata[shape][index]) {
240 std::vector<std::vector<bool>> occupiedStrata;
246 for (
int i = 0; i <
size; ++i) {
255 constexpr
int odd[8] = {0, 1, 4, 5, 10, 11, 14, 15};
256 constexpr
int even[8] = {2, 3, 6, 7, 8, 9, 12, 13};
259 for (
int yy = 0; yy <
size / 16; ++yy) {
260 for (
int xx = 0; xx < 8; ++xx) {
261 int other = (int)(
cmj_randfloat(++rng_index, rng_seed) * (8.0f - xx) + xx);
262 float2 tmp = points[odd[other] + yy * 16];
263 points[odd[other] + yy * 16] = points[odd[xx] + yy * 16];
264 points[odd[xx] + yy * 16] = tmp;
266 for (
int xx = 0; xx < 8; ++xx) {
267 int other = (int)(
cmj_randfloat(++rng_index, rng_seed) * (8.0f - xx) + xx);
268 float2 tmp = points[even[other] + yy * 16];
269 points[even[other] + yy * 16] = points[even[xx] + yy * 16];
270 points[even[xx] + yy * 16] = tmp;
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void mark_occupied_strata(float2 points[], int N) override
bool is_occupied(float2 pt, int NN)
void mark_occupied_strata1(float2 pt, int NN)
void generate_sample_point(float2 points[], float i, float j, float xhalf, float yhalf, int n, int N) override
std::vector< bool > occupied1Dx
static void generate_2D(float2 points[], int size, int rng_seed_in)
virtual void generate_sample_point(float2 points[], float i, float j, float xhalf, float yhalf, int n, int N)
PMJ_Generator(int rnd_seed_in)
void extend_sequence_even(float2 points[], int N)
void extend_sequence_odd(float2 points[], int N)
std::vector< bool > occupied1Dy
virtual void mark_occupied_strata(float2 points[], int N)
static float cmj_randfloat(uint i, uint p)
void progressive_multi_jitter_02_generate_2D(float2 points[], int size, int rng_seed)
static void shuffle(float2 points[], int size, int rng_seed)
static CCL_NAMESPACE_BEGIN uint cmj_hash(uint i, uint p)
void progressive_multi_jitter_generate_2D(float2 points[], int size, int rng_seed)
#define CCL_NAMESPACE_END