Skip to content

Commit

Permalink
grouped environments
Browse files Browse the repository at this point in the history
  • Loading branch information
lastmc committed Apr 17, 2024
1 parent e736eb3 commit 5ea78f6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/environments/grouped.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@ class GroupedInstance final : public Environment::Instance {
for (auto i = 0; i < _envs.size(); i++) {
$case(i) {
sample = _envs[i]->sample(swl, time, u);
auto L = SampledSpectrum{swl.dimension()};
auto pdf = def(0.f);
for(auto &item: _envs){
auto eval_item = item->evaluate(sample.wi, swl, time);
L += scale * eval_item.L;
pdf += scale * eval_item.pdf;
}
sample.eval.L = L;
sample.eval.pdf = pdf;
};
}
$default { unreachable(); };
};
auto L = SampledSpectrum{swl.dimension()};
auto pdf = def(0.f);
for(auto &item: _envs){
auto eval_item = item->evaluate(sample.wi, swl, time);
L += scale * eval_item.L;
pdf += scale * eval_item.pdf;
}
sample.eval.L = L;
sample.eval.pdf = pdf;
sample.wi = normalize(transform_to_world() * sample.wi);
return sample;
}
Expand Down

0 comments on commit 5ea78f6

Please sign in to comment.