Fix more bugs

This commit is contained in:
hal8174 2024-06-27 08:54:09 +02:00
parent 9e328cf9e3
commit ef6013ce4f
4 changed files with 18 additions and 15 deletions

View file

@ -50,30 +50,29 @@ public:
}
if (large_step)
last_large_step = time;
index = 0;
new_data.clear();
}
void new_ray(bool l) {
index = 0;
new_data.clear();
large_step = l;
}
bool is_large_step() { return large_step; }
float get1D() override {
float result;
if (is_large_step()) {
float r = RandomSampler_get1D(sampler);
new_data.push_back(r);
index++;
return r;
result = r;
} else {
if (index >= data.size()) {
float r = RandomSampler_get1D(sampler);
data.push_back(r);
last_changed.push_back(time);
new_data.push_back(r);
index++;
return r;
result = r;
}
// printf("%d, %d\n", index, last_large_step);
if (last_changed.at(index) < last_large_step) {
@ -81,8 +80,7 @@ public:
data.at(index) = r;
last_changed.at(index) = time;
new_data.push_back(r);
index++;
return r;
result = r;
} else {
size_t steps = time - last_changed.at(index);
float d = data.at(index);
@ -99,11 +97,13 @@ public:
d = normalize(d + o);
new_data.push_back(d);
// printf("%f, %f\n", data.at(index), d);
index++;
return d;
// printf("%zu, %zu, %f, %f\n", index, steps, data.at(index), d);
result = d;
}
}
// printf("%zu, %f\n", index, result);
index++;
return result;
}
embree::Vec2f get2D() override { return embree::Vec2f(get1D(), get1D()); }