Implement CreateStratifiedSampler
wahn opened this issue · 2 comments
wahn commented
On the C++ side:
> rg -tcpp CreateStratifiedSampler
samplers/stratified.cpp
79:StratifiedSampler *CreateStratifiedSampler(const ParamSet ¶ms) {
core/api.cpp
835: sampler = CreateStratifiedSampler(paramSet);
samplers/stratified.h
66:StratifiedSampler *CreateStratifiedSampler(const ParamSet ¶ms);
TODO: Rust counterpart ...
wahn commented
After commit 1f805e7 we get a 100% match to the C++ counterpart:
> imf_diff pbrt_rust.exr pbrt.exr
pbrt_rust.exr pbrt.exr: no differences.
== "pbrt_rust.exr" and "pbrt.exr" are identical
Still there are some bits and pieces missing:
impl StratifiedSampler {
...
pub fn start_pixel(&mut self, p: &Point2i) {
...
// generate arrays of stratified samples for the pixel
for i in 0..self.samples_1d_array_sizes.len() {
// for (int64_t j = 0; j < samplesPerPixel; ++j) {
// int count = samples1DArraySizes[i];
// stratified_sample_1d(&sampleArray1D[i][j * count], count, rng,
// self.jitter_samples);
// Shuffle(&sampleArray1D[i][j * count], count, 1, rng);
}
for i in 0..self.samples_2d_array_sizes.len() {
// for (int64_t j = 0; j < samplesPerPixel; ++j) {
// int count = samples2DArraySizes[i];
// LatinHypercube(&sampleArray2D[i][j * count].x, count, 2, rng);
}
...
}
...
}