void DirectLightingIntegrator::RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene) { if (strategy == SAMPLE_ALL_UNIFORM) { // Allocate and request samples for sampling all lights uint32_t nLights = scene->lights.size(); lightSampleOffsets = new LightSampleOffsets[nLights]; bsdfSampleOffsets = new BSDFSampleOffsets[nLights]; for (uint32_t i = 0; i < nLights; ++i) { const Light *light = scene->lights[i]; int nSamples = light->nSamples; if (sampler) nSamples = sampler->RoundSize(nSamples); lightSampleOffsets[i] = LightSampleOffsets(nSamples, sample); bsdfSampleOffsets[i] = BSDFSampleOffsets(nSamples, sample); } lightNumOffset = -1; } else { // Allocate and request samples for sampling one light lightSampleOffsets = new LightSampleOffsets[1]; lightSampleOffsets[0] = LightSampleOffsets(1, sample); lightNumOffset = sample->Add1D(1); bsdfSampleOffsets = new BSDFSampleOffsets[1]; bsdfSampleOffsets[0] = BSDFSampleOffsets(1, sample); } }
// PathIntegrator Method Definitions void PathIntegrator::RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene) { for (int i = 0; i < SAMPLE_DEPTH; ++i) { lightSampleOffsets[i] = LightSampleOffsets(1, sample); lightNumOffset[i] = sample->Add1D(1); bsdfSampleOffsets[i] = BSDFSampleOffsets(1, sample); pathSampleOffsets[i] = BSDFSampleOffsets(1, sample); } }
void UseRadianceProbes::RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene) { // Allocate and request samples for sampling all lights uint32_t nLights = scene->lights.size(); lightSampleOffsets = new LightSampleOffsets[nLights]; bsdfSampleOffsets = new BSDFSampleOffsets[nLights]; for (uint32_t i = 0; i < nLights; ++i) { const Light *light = scene->lights[i]; int nSamples = light->nSamples; if (sampler) nSamples = sampler->RoundSize(nSamples); lightSampleOffsets[i] = LightSampleOffsets(nSamples, sample); bsdfSampleOffsets[i] = BSDFSampleOffsets(nSamples, sample); } }
// IrradianceCacheIntegrator Method Definitions void IrradianceCacheIntegrator::RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene) { // if (lightSampleOffsets != NULL) return; // Allocate and request samples for sampling all lights u_int nLights = scene->lights.size(); lightSampleOffsets = new LightSampleOffsets[nLights]; bsdfSampleOffsets = new BSDFSampleOffsets[nLights]; for (u_int i = 0; i < nLights; ++i) { const Light *light = scene->lights[i]; int nSamples = light->nSamples; if (sampler) nSamples = sampler->RoundSize(nSamples); lightSampleOffsets[i] = LightSampleOffsets(nSamples, sample); bsdfSampleOffsets[i] = BSDFSampleOffsets(nSamples, sample); } }
void IGIIntegrator::RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene) { // Allocate and request samples for sampling all lights u_int nLights = scene->lights.size(); lightSampleOffsets = new LightSampleOffsets[nLights]; bsdfSampleOffsets = new BSDFSampleOffsets[nLights]; for (u_int i = 0; i < nLights; ++i) { const Light *light = scene->lights[i]; int nSamples = light->nSamples; if (sampler) nSamples = sampler->RoundSize(nSamples); lightSampleOffsets[i] = LightSampleOffsets(nSamples, sample); bsdfSampleOffsets[i] = BSDFSampleOffsets(nSamples, sample); } vlSetOffset = sample->Add1D(1); if (sampler) nGatherSamples = sampler->RoundSize(nGatherSamples); gatherSampleOffset = BSDFSampleOffsets(nGatherSamples, sample); }
void PhotonIntegrator::RequestSamples(Sampler *sampler, Sample *sample, const Scene *scene) { // Allocate and request samples for sampling all lights uint32_t nLights = scene->lights.size(); lightSampleOffsets = new LightSampleOffsets[nLights]; bsdfSampleOffsets = new BSDFSampleOffsets[nLights]; for (uint32_t i = 0; i < nLights; ++i) { const Light *light = scene->lights[i]; int nSamples = light->nSamples; if (sampler) nSamples = sampler->RoundSize(nSamples); lightSampleOffsets[i] = LightSampleOffsets(nSamples, sample); bsdfSampleOffsets[i] = BSDFSampleOffsets(nSamples, sample); } // Request samples for final gathering if (finalGather) { gatherSamples = max(1, gatherSamples/2); if (sampler) gatherSamples = sampler->RoundSize(gatherSamples); bsdfGatherSampleOffsets = BSDFSampleOffsets(gatherSamples, sample); indirGatherSampleOffsets = BSDFSampleOffsets(gatherSamples, sample); } }