| 132 | } |
| 133 | |
| 134 | static float CMJRandFloat(uint32 i, uint32 p) |
| 135 | { |
| 136 | i ^= p; |
| 137 | i ^= i >> 17; |
| 138 | i ^= i >> 10; i *= 0xb36534e5; |
| 139 | i ^= i >> 12; |
| 140 | i ^= i >> 21; i *= 0x93fc4795; |
| 141 | i ^= 0xdf6e307f; |
| 142 | i ^= i >> 17; i *= 1 | p >> 18; |
| 143 | return i * (1.0f / 4294967808.0f); |
| 144 | } |
| 145 | |
| 146 | // Returns a 2D sample from a particular pattern using correlated multi-jittered sampling [Kensler 2013] |
| 147 | Float2 SampleCMJ2D(int32 sampleIdx, int32 numSamplesX, int32 numSamplesY, int32 pattern) |