Commits

Jean-Philippe Grimaldi committed e519af1

Add the nsamples parameter to the distant light.

Jeanphi

  • Participants
  • Parent commits b747092

Comments (0)

Files changed (2)

lights/distant.cpp

 // DistantLight Method Definitions
 DistantLight::DistantLight(const Transform &light2world,
 	const boost::shared_ptr<Texture<SWCSpectrum> > &L, 
-	float g, float theta, const Vector &dir)
-	: Light(light2world), Lbase(L) {
+	float g, float theta, const Vector &dir, u_int ns)
+	: Light(light2world, ns), Lbase(L) {
 	lightDir = Normalize(LightToWorld(dir));
 	CoordinateSystem(lightDir, &x, &y);
 	Lbase->SetIlluminant();
 {
 	boost::shared_ptr<Texture<SWCSpectrum> > L(paramSet.GetSWCSpectrumTexture("L", RGBColor(1.f)));
 	float g = paramSet.FindOneFloat("gain", 1.f);
+	int nSamples = paramSet.FindOneInt("nsamples", 1);
 	float theta = Radians(paramSet.FindOneFloat("theta", 0.f));
 	Point from = paramSet.FindOnePoint("from", Point(0, 0, 0));
 	Point to = paramSet.FindOnePoint("to", Point(0, 0, 1));
 	Vector dir = from - to;
-	DistantLight *l = new DistantLight(light2world, L, g, theta, dir);
+	DistantLight *l = new DistantLight(light2world, L, g, theta, dir, nSamples);
 	l->hints.InitParam(paramSet);
 	return l;
 }
 	// DistantLight Public Methods
 	DistantLight(const Transform &light2world, 
 		const boost::shared_ptr<Texture<SWCSpectrum> > &L, float gain, 
-		float theta, const Vector &dir);
+		float theta, const Vector &dir, u_int ns);
 	virtual ~DistantLight();
 	virtual bool IsDeltaLight() const { return false; }
 	virtual bool IsEnvironmental() const { return true; }