CameraSample 类
struct CameraSample {
float imageX, imageY;
float lensU, lensV;
float time;
};
类的作用:
(这个类代表的就是采样点,传入采样点给Camera ,会根据采样点生成 Ray,传入采样点给 Integrators,会执行光照计算
CameraSample 代表的只是作为生成射线的采样点)
The Sample structure is used by Samplers to store a single sample. After one or more
Samples is initialized by a call to the Sampler’s GetMoreSamples() method, the Sampler
RendererTask::Run() method passes each of the Samples to the camera and integrators,
which read values from it to construct the camera ray and perform lighting calculations
Sample inherits from the CameraSample structure; the CameraSample represents just the
sample values that are needed for generating camera rays. This separation allows us to
just pass a CameraSample to the Camera::GenerateRay() method, not exposing all of the
details of the rest of the Sample structure to Cameras.
Sample 类
struct Sample : public CameraSample {
// Sample Public Methods
Sample(Sampler *sampler, SurfaceIntegrator *surf, VolumeIntegrator *vol,
const Scene *scene);
uint32_t Add1D(uint32_t num) {
n1D.push_back(num);
return n1D.size() - 1;
}
uint32_t Add2D(uint32_t num) {
n2D.push_back(num);
return n2D.size() - 1;
}
~Sample() {
if (oneD != NULL) {
FreeAligned(oneD[0]);
FreeAligned(oneD);
}
}
Sample *Duplicate(int count) const;
vector<uint32_t> n1D, n2D;
float **oneD, **twoD;
private:
v