libpython: allow extracting the bitmap underlying an environment map
parent
359f8215f4
commit
08623fafdc
|
@ -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 <tt>-1, -1</tt> allows the implementation to choose a suitable
|
||||
* size by itself.
|
||||
*
|
||||
* \remark The default implementation throws an exception
|
||||
*/
|
||||
virtual ref<Bitmap> getBitmap(const Vector2i &sizeHint = Vector2i(-1, -1)) const;
|
||||
|
||||
/// Serialize this emitter to a binary data stream
|
||||
virtual void serialize(Stream *stream, InstanceManager *manager) const;
|
||||
|
||||
|
|
|
@ -632,6 +632,10 @@ public:
|
|||
* m_normalization / std::max(std::abs(sinTheta), Epsilon);
|
||||
}
|
||||
|
||||
ref<Bitmap> getBitmap(const Vector2i &/* unused */) const {
|
||||
return m_mipmap->toBitmap();
|
||||
}
|
||||
|
||||
std::string toString() const {
|
||||
std::ostringstream oss;
|
||||
oss << "EnvironmentMap[" << endl
|
||||
|
|
|
@ -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_<Emitter::EEmitterFlags>("EEmitterFlags")
|
||||
|
|
|
@ -144,6 +144,10 @@ bool Emitter::isCompound() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
ref<Bitmap> Emitter::getBitmap(const Vector2i &sizeHint) const {
|
||||
NotImplementedError("getBitmap");
|
||||
}
|
||||
|
||||
MTS_IMPLEMENT_CLASS(Emitter, false, AbstractEmitter)
|
||||
MTS_IMPLEMENT_CLASS(AbstractEmitter, true, ConfigurableObject)
|
||||
MTS_NAMESPACE_END
|
||||
|
|
Loading…
Reference in New Issue