| 357 | } |
| 358 | |
| 359 | static float CMJRandFloat(uint32 i, uint32 p) |
| 360 | { |
| 361 | i ^= p; |
| 362 | i ^= i >> 17; |
| 363 | i ^= i >> 10; i *= 0xb36534e5; |
| 364 | i ^= i >> 12; |
| 365 | i ^= i >> 21; i *= 0x93fc4795; |
| 366 | i ^= 0xdf6e307f; |
| 367 | i ^= i >> 17; i *= 1 | p >> 18; |
| 368 | return i * (1.0f / 4294967808.0f); |
| 369 | } |
| 370 | |
| 371 | // Returns a 2D sample from a particular pattern using correlated multi-jittered sampling [Kensler 2013] |
| 372 | Float2 SampleCMJ2D(int32 sampleIdx, int32 numSamplesX, int32 numSamplesY, int32 pattern) |