提交 1416525b 编写于 作者: M Matt Pharr

Update from book source. No functional changes.

上级 56d6d4f0
......@@ -153,11 +153,10 @@ BVHAggregate::BVHAggregate(std::vector<Primitive> prims, int maxPrimsInNode,
// Declare _Allocator_s used for BVH construction
pstd::pmr::monotonic_buffer_resource resource;
Allocator alloc(&resource);
std::vector<std::unique_ptr<pstd::pmr::monotonic_buffer_resource>>
threadBufferResources;
using Resource = pstd::pmr::monotonic_buffer_resource;
std::vector<std::unique_ptr<Resource>> threadBufferResources;
ThreadLocal<Allocator> threadAllocators([&threadBufferResources]() {
threadBufferResources.push_back(
std::make_unique<pstd::pmr::monotonic_buffer_resource>());
threadBufferResources.push_back(std::make_unique<Resource>());
auto ptr = threadBufferResources.back().get();
return Allocator(ptr);
});
......
......@@ -1055,7 +1055,8 @@ SampledSpectrum VolPathIntegrator::Li(RayDifferential ray, SampledWavelengths &l
ClampZero(sigma_maj - mp.sigma_a - mp.sigma_s);
Float pdf = T_maj[0] * sigma_n[0];
beta *= T_maj * sigma_n / pdf;
if (pdf == 0) beta = SampledSpectrum(0.f);
if (pdf == 0)
beta = SampledSpectrum(0.f);
r_u *= T_maj * sigma_n / pdf;
r_l *= T_maj * sigma_maj / pdf;
return beta && r_u;
......@@ -1304,12 +1305,12 @@ SampledSpectrum VolPathIntegrator::SampleLd(const Interaction &intr, const BSDF
SampledSpectrum f_hat;
Vector3f wo = intr.wo, wi = ls->wi;
if (bsdf) {
// Update _bsdfLight_ and _scatterPDF_ accounting for the BSDF
// Update _f_hat_ and _scatterPDF_ accounting for the BSDF
f_hat = bsdf->f(wo, wi) * AbsDot(wi, intr.AsSurface().shading.n);
scatterPDF = bsdf->PDF(wo, wi);
} else {
// Update _bsdfLight_ and _scatterPDF_ accounting for the phase function
// Update _f_hat_ and _scatterPDF_ accounting for the phase function
CHECK(intr.IsMediumInteraction());
PhaseFunction phase = intr.AsMedium().phase;
f_hat = SampledSpectrum(phase.p(wo, wi));
......
......@@ -128,7 +128,8 @@ void WavefrontPathIntegrator::SampleMediumInteraction(int wavefrontDepth) {
Float pr = T_maj[0] * sigma_n[0];
beta *= T_maj * sigma_n / pr;
if (pr == 0) beta = SampledSpectrum(0.f);
if (pr == 0)
beta = SampledSpectrum(0.f);
inv_w_u *= T_maj * sigma_n / pr;
inv_w_l *= T_maj * sigma_maj / pr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册