diff --git a/include/mitsuba/render/emitter.h b/include/mitsuba/render/emitter.h
index 4a6015be..3b08fa7e 100644
--- a/include/mitsuba/render/emitter.h
+++ b/include/mitsuba/render/emitter.h
@@ -534,6 +534,24 @@ public:
*/
inline Float getSamplingWeight() const { return m_samplingWeight; }
+ /**
+ * \brief Return a bitmap representation of the emitter
+ *
+ * Some types of light sources (projection lights, environment maps)
+ * are closely tied to an underlying bitmap data structure. This function
+ * can be used to return this information for various purposes.
+ *
+ * When the class implementing this interface is a bitmap-backed texture,
+ * this function directly returns the underlying bitmap. When it is procedural,
+ * a bitmap version must first be generated. In this case, the parameter
+ * \ref sizeHint is used to control the target size. The default
+ * value -1, -1 allows the implementation to choose a suitable
+ * size by itself.
+ *
+ * \remark The default implementation throws an exception
+ */
+ virtual ref getBitmap(const Vector2i &sizeHint = Vector2i(-1, -1)) const;
+
/// Serialize this emitter to a binary data stream
virtual void serialize(Stream *stream, InstanceManager *manager) const;
diff --git a/src/emitters/envmap.cpp b/src/emitters/envmap.cpp
index 97658889..f29b1fa3 100644
--- a/src/emitters/envmap.cpp
+++ b/src/emitters/envmap.cpp
@@ -632,6 +632,10 @@ public:
* m_normalization / std::max(std::abs(sinTheta), Epsilon);
}
+ ref getBitmap(const Vector2i &/* unused */) const {
+ return m_mipmap->toBitmap();
+ }
+
std::string toString() const {
std::ostringstream oss;
oss << "EnvironmentMap[" << endl
diff --git a/src/libpython/render.cpp b/src/libpython/render.cpp
index 70f0560f..d78dc3a0 100644
--- a/src/libpython/render.cpp
+++ b/src/libpython/render.cpp
@@ -607,7 +607,10 @@ void export_render() {
.def("eval", &Emitter::eval, BP_RETURN_VALUE)
.def("getSamplingWeight", &Emitter::getSamplingWeight)
.def("isEnvironmentEmitter", &Emitter::isEnvironmentEmitter)
- .def("evalEnvironment", &Emitter::evalEnvironment, BP_RETURN_VALUE);
+ .def("evalEnvironment", &Emitter::evalEnvironment, BP_RETURN_VALUE)
+ .def("isCompound", &Emitter::isCompound)
+ .def("getElement", &Emitter::getElement, BP_RETURN_VALUE)
+ .def("getBitmap", &Emitter::getBitmap, getBitmap_overloads()[BP_RETURN_VALUE]);
BP_SETSCOPE(Emitter_class);
bp::enum_("EEmitterFlags")
diff --git a/src/librender/emitter.cpp b/src/librender/emitter.cpp
index f402dda6..ddd04479 100644
--- a/src/librender/emitter.cpp
+++ b/src/librender/emitter.cpp
@@ -144,6 +144,10 @@ bool Emitter::isCompound() const {
return false;
}
+ref Emitter::getBitmap(const Vector2i &sizeHint) const {
+ NotImplementedError("getBitmap");
+}
+
MTS_IMPLEMENT_CLASS(Emitter, false, AbstractEmitter)
MTS_IMPLEMENT_CLASS(AbstractEmitter, true, ConfigurableObject)
MTS_NAMESPACE_END