void Shape::configure() {
	if (m_bsdf == NULL) {
		ref<BSDF> bsdf = NULL;
		if (isEmitter() || isSensor() || hasSubsurface()) {
			/* Light source / sensor and no BSDF! -> set an all-absorbing BSDF */
			Properties props("diffuse");
			props.setSpectrum("reflectance", Spectrum(0.0f));
			bsdf = static_cast<BSDF *> (PluginManager::getInstance()->
				createObject(MTS_CLASS(BSDF), props));
		} else if (!isMediumTransition()) {
			/* A surface without BSDF, which is not a medium
			   transition/sensor/emitter/subsurface emitter doesn't make
			   much sense. Assign it a 0.5 Lambertian BRDF for convenience */
			Properties props("diffuse");
			props.setSpectrum("reflectance", Spectrum(0.5f));
			bsdf = static_cast<BSDF *> (PluginManager::getInstance()->
				createObject(MTS_CLASS(BSDF), props));
		} else {
			/* Assign a "null" BSDF */
			bsdf = static_cast<BSDF *> (PluginManager::getInstance()->
				createObject(MTS_CLASS(BSDF), Properties("null")));
		}
		bsdf->configure();
		addChild(bsdf);
	}

	if ((m_bsdf->getType() & BSDF::ENull) && (isEmitter() || isSensor() || hasSubsurface()))
		Log(EError, "Shape \"%s\" has an index-matched BSDF and an "
			"emitter/sensor/subsurface attachment. This is not allowed!", getName().c_str());
}
Exemple #2
0
	std::string toString() const {
		std::ostringstream oss;
		oss << "Rectangle[" << endl
			<< "  objectToWorld = " << indent(m_objectToWorld.toString()) << "," << endl;
		if (isMediumTransition())
			oss << "  interiorMedium = " << indent(m_interiorMedium.toString()) << "," << endl
				<< "  exteriorMedium = " << indent(m_exteriorMedium.toString()) << "," << endl;
		oss << "  bsdf = " << indent(m_bsdf.toString()) << "," << endl
			<< "  emitter = " << indent(m_emitter.toString()) << "," << endl
			<< "  sensor = " << indent(m_sensor.toString()) << "," << endl
			<< "  subsurface = " << indent(m_subsurface.toString()) << endl
			<< "]";
		return oss.str();
	}
Exemple #3
0
std::string TriMesh::toString() const {
	std::ostringstream oss;
	oss << getClass()->getName() << "[" << endl
		<< "  name = \"" << m_name<< "\"," << endl
		<< "  triangleCount = " << m_triangleCount << "," << endl
		<< "  vertexCount = " << m_vertexCount << "," << endl
		<< "  faceNormals = " << (m_faceNormals ? "true" : "false") << "," << endl
		<< "  hasNormals = " << (m_normals ? "true" : "false") << "," << endl
		<< "  hasTexcoords = " << (m_texcoords ? "true" : "false") << "," << endl
		<< "  hasTangents = " << (m_tangents ? "true" : "false") << "," << endl
		<< "  hasColors = " << (m_colors ? "true" : "false") << "," << endl
		<< "  surfaceArea = " << m_surfaceArea << "," << endl
		<< "  aabb = " << m_aabb.toString() << "," << endl
		<< "  bsdf = " << indent(m_bsdf.toString()) << "," << endl
		<< "  subsurface = " << indent(m_subsurface.toString()) << "," << endl;
	if (isMediumTransition()) {
		oss << "  interiorMedium = " << indent(m_interiorMedium.toString()) << "," << endl
			<< "  exteriorMedium = " << indent(m_exteriorMedium.toString()) << "," << endl;
	}
	oss << "  luminaire = " << indent(m_luminaire.toString()) << endl
		<< "]";
	return oss.str();
}