本文整理汇总了C++中Sampler::Get2DArray方法的典型用法代码示例。如果您正苦于以下问题:C++ Sampler::Get2DArray方法的具体用法?C++ Sampler::Get2DArray怎么用?C++ Sampler::Get2DArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sampler
的用法示例。
在下文中一共展示了Sampler::Get2DArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UniformSampleAllLights
// Integrator Utility Functions
Spectrum UniformSampleAllLights(const Interaction &it, const Scene &scene,
MemoryArena &arena, Sampler &sampler,
const std::vector<int> &nLightSamples,
bool handleMedia) {
ProfilePhase p(Prof::DirectLighting);
Spectrum L(0.f);
for (size_t j = 0; j < scene.lights.size(); ++j) {
// Accumulate contribution of _j_th light to _L_
const std::shared_ptr<Light> &light = scene.lights[j];
int nSamples = nLightSamples[j];
const Point2f *uLightArray = sampler.Get2DArray(nSamples);
const Point2f *uScatteringArray = sampler.Get2DArray(nSamples);
if (!uLightArray || !uScatteringArray) {
// Use a single sample for illumination from _light_
Point2f uLight = sampler.Get2D();
Point2f uScattering = sampler.Get2D();
L += EstimateDirect(it, uScattering, *light, uLight, scene, sampler,
arena, handleMedia);
} else {
// Estimate direct lighting using sample arrays
Spectrum Ld(0.f);
for (int k = 0; k < nSamples; ++k)
Ld += EstimateDirect(it, uScatteringArray[k], *light,
uLightArray[k], scene, sampler, arena,
handleMedia);
L += Ld / nSamples;
}
}
return L;
}