PBRT_V2 总结记录 <21> CameraSample 和 Sample

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值