Spectrum Li(const RayDifferential &ray, RadianceQueryRecord &rRec) const {
		Intersection &its = rRec.its;

		if (m_indirectOnly && (rRec.type & RadianceQueryRecord::EDirectSurfaceRadiance))
			rRec.type ^= RadianceQueryRecord::EDirectSurfaceRadiance;

		if (rRec.rayIntersect(ray)) {
			const BSDF *bsdf = its.getBSDF(ray);

			if (bsdf && (bsdf->getType() & BSDF::EAll) == BSDF::EDiffuseReflection &&
					(rRec.type & RadianceQueryRecord::EIndirectSurfaceRadiance)) {
				Spectrum E;

				if (Frame::cosTheta(its.wi) <= 0) {
					E = Spectrum(0.0f);
				} else if (!m_irrCache->get(its, E)) {
					handleMiss(ray, rRec, E);

					if (m_debug)
						E.fromLinearRGB(1e3, 0, 0);
				}

				rRec.type ^= RadianceQueryRecord::EIndirectSurfaceRadiance;

				return E * bsdf->getDiffuseReflectance(its) * INV_PI +
					m_subIntegrator->Li(ray, rRec);
			}
		}
		return m_subIntegrator->Li(ray, rRec);
	}
示例#2
0
	Spectrum getMinimum() const {
		Spectrum result;
		if (m_mipmap3.get()) {
			Color3 value = m_mipmap3->getMinimum();
			result.fromLinearRGB(value[0], value[1], value[2]);
		} else {
			Color1 value = m_mipmap1->getMinimum();
			result = Spectrum(value[0]);
		}
		return result;
	}
示例#3
0
	Spectrum eval(const Point2 &uv, const Vector2 &d0, const Vector2 &d1) const {
		stats::filteredLookups.incrementBase();
		++stats::filteredLookups;

		Spectrum result;
		if (m_mipmap3.get()) {
			Color3 value = m_mipmap3->eval(uv, d0, d1);
			result.fromLinearRGB(value[0], value[1], value[2]);
		} else {
			Color1 value = m_mipmap1->eval(uv, d0, d1);
			result = Spectrum(value[0]);
		}
		return result;
	}
示例#4
0
	Spectrum eval(const Point2 &uv) const {
		/* There are no ray differentials to do any kind of
		   prefiltering. Evaluate the full-resolution texture */

		Spectrum result;
		if (m_mipmap3.get()) {
			Color3 value;
			if (m_mipmap3->getFilterType() != ENearest)
				value = m_mipmap3->evalBilinear(0, uv);
			else
				value = m_mipmap3->evalBox(0, uv);
			result.fromLinearRGB(value[0], value[1], value[2]);
		} else {
			Color1 value;
			if (m_mipmap1->getFilterType() != ENearest)
				value = m_mipmap1->evalBilinear(0, uv);
			else
				value = m_mipmap1->evalBox(0, uv);
			result = Spectrum(value[0]);
		}
		stats::filteredLookups.incrementBase();

		return result;
	}
	/// Initialize the integrator with the specified properties 
	MyIntegrator(const Properties &props) : SamplingIntegrator(props) {
        Spectrum defaultColor;
        defaultColor.fromLinearRGB(0.2f, 0.5f, 0.2f);
		m_color = props.getSpectrum("color", defaultColor);
    }