38 return cmj_hash(i, p) * (1.0f / 4294967808.0f);
46 points[0].
x =
g.rnd();
47 points[0].
y =
g.rnd();
50 g.extend_sequence_even(points,
N);
51 g.extend_sequence_odd(points, 2 *
N);
69 for (
int s = 0; s < NN; ++s) {
72 for (
int s = 0; s <
N; ++s) {
73 int xstratum = (int)(NN * points[s].
x);
74 int ystratum = (int)(NN * points[s].
y);
81 float2 points[],
float i,
float j,
float xhalf,
float yhalf,
int n,
int N)
85 int xstratum, ystratum;
87 pt.
x = (i + 0.5f * (xhalf +
rnd())) / n;
88 xstratum = (int)(NN * pt.
x);
91 pt.
y = (j + 0.5f * (yhalf +
rnd())) / n;
92 ystratum = (int)(NN * pt.
y);
106 for (
int s = 0; s <
N; ++s) {
110 float xhalf =
floorf(2.0f * (n * oldpt.
x - i));
111 float yhalf =
floorf(2.0f * (n * oldpt.
y - j));
112 xhalf = 1.0f - xhalf;
113 yhalf = 1.0f - yhalf;
120 int n = (int)
sqrtf(
N / 2);
124 std::vector<float> xhalves(
N / 2);
125 std::vector<float> yhalves(
N / 2);
126 for (
int s = 0; s <
N / 2; ++s) {
130 float xhalf =
floorf(2.0f * (n * oldpt.
x - i));
131 float yhalf =
floorf(2.0f * (n * oldpt.
y - j));
133 xhalf = 1.0f - xhalf;
136 yhalf = 1.0f - yhalf;
142 for (
int s = 0; s <
N / 2; ++s) {
146 float xhalf = 1.0f - xhalves[s];
147 float yhalf = 1.0f - yhalves[s];
160 float2 points[],
float i,
float j,
float xhalf,
float yhalf,
int n,
int N)
override
165 pt.
x = (i + 0.5f * (xhalf +
rnd())) / n;
166 pt.
y = (j + 0.5f * (yhalf +
rnd())) / n;
176 int num_shapes = (int)log2f(NN) + 1;
177 occupiedStrata.resize(num_shapes);
178 for (
int shape = 0; shape < num_shapes; ++shape) {
179 occupiedStrata[shape].resize(NN);
180 for (
int n = 0; n < NN; ++n) {
181 occupiedStrata[shape][n] =
false;
184 for (
int s = 0; s <
N; ++s) {
195 int xstratum = (int)(xdivs * pt.
x);
196 int ystratum = (int)(ydivs * pt.
y);
197 size_t index = ystratum * xdivs + xstratum;
199 occupiedStrata[shape][index] =
true;
212 int xstratum = (int)(xdivs * pt.
x);
213 int ystratum = (int)(ydivs * pt.
y);
214 size_t index = ystratum * xdivs + xstratum;
216 if (occupiedStrata[shape][index]) {
227 std::vector<std::vector<bool>> occupiedStrata;
236 constexpr
int odd[8] = {0, 1, 4, 5, 10, 11, 14, 15};
237 constexpr
int even[8] = {2, 3, 6, 7, 8, 9, 12, 13};
240 for (
int yy = 0; yy <
size / 16; ++yy) {
241 for (
int xx = 0; xx < 8; ++xx) {
242 int other = (int)(
cmj_randfloat(++rng_index, rng_seed) * (8.0f - xx) + xx);
243 float2 tmp = points[odd[other] + yy * 16];
244 points[odd[other] + yy * 16] = points[odd[xx] + yy * 16];
245 points[odd[xx] + yy * 16] = tmp;
247 for (
int xx = 0; xx < 8; ++xx) {
248 int other = (int)(
cmj_randfloat(++rng_index, rng_seed) * (8.0f - xx) + xx);
249 float2 tmp = points[even[other] + yy * 16];
250 points[even[other] + yy * 16] = points[even[xx] + yy * 16];
251 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)
#define CCL_NAMESPACE_END
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)
static const pxr::TfToken g("g", pxr::TfToken::Immortal)