libpython: improved Texture bindings
parent
70f08931b9
commit
b198521eb1
|
@ -48,6 +48,7 @@ public:
|
||||||
* two \ref Spectrum data structures corresponding to the U and V derivative.
|
* two \ref Spectrum data structures corresponding to the U and V derivative.
|
||||||
*
|
*
|
||||||
* \remark This function is usually implemented pointwise without any kind of filtering.
|
* \remark This function is usually implemented pointwise without any kind of filtering.
|
||||||
|
* The Python signature is <tt>dx, dy = tex.evalGradient(its)</tt>.
|
||||||
*/
|
*/
|
||||||
virtual void evalGradient(const Intersection &its, Spectrum *gradient) const;
|
virtual void evalGradient(const Intersection &its, Spectrum *gradient) const;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,12 @@ static const Intersection &bsdfsamplingrecord_get_its(const BSDFSamplingRecord &
|
||||||
return bRec.its;
|
return bRec.its;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bp::tuple texture_evalGradient(const Texture *texture, const Intersection &its) {
|
||||||
|
Spectrum grad[2];
|
||||||
|
texture->evalGradient(its, grad);
|
||||||
|
return bp::make_tuple(grad[0], grad[1]);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned int bsdf_getType_1(const BSDF *bsdf) {
|
static unsigned int bsdf_getType_1(const BSDF *bsdf) {
|
||||||
return bsdf->getType();
|
return bsdf->getType();
|
||||||
}
|
}
|
||||||
|
@ -301,6 +307,8 @@ bp::tuple Sensor_getSamplePosition(Sensor *sensor, const PositionSamplingRecord
|
||||||
return bp::make_tuple(result, samplePos);
|
return bp::make_tuple(result, samplePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getBitmap_overloads, getBitmap, 0, 1)
|
||||||
|
|
||||||
void export_render() {
|
void export_render() {
|
||||||
bp::object renderModule(
|
bp::object renderModule(
|
||||||
bp::handle<>(bp::borrowed(PyImport_AddModule("mitsuba.render"))));
|
bp::handle<>(bp::borrowed(PyImport_AddModule("mitsuba.render"))));
|
||||||
|
@ -756,12 +764,16 @@ void export_render() {
|
||||||
|
|
||||||
BP_CLASS(Texture, ConfigurableObject, bp::no_init)
|
BP_CLASS(Texture, ConfigurableObject, bp::no_init)
|
||||||
.def("eval", &Texture::eval, BP_RETURN_VALUE)
|
.def("eval", &Texture::eval, BP_RETURN_VALUE)
|
||||||
|
.def("evalGradient", &texture_evalGradient)
|
||||||
.def("getAverage", &Texture::getAverage, BP_RETURN_VALUE)
|
.def("getAverage", &Texture::getAverage, BP_RETURN_VALUE)
|
||||||
.def("getMinimum", &Texture::getMinimum, BP_RETURN_VALUE)
|
.def("getMinimum", &Texture::getMinimum, BP_RETURN_VALUE)
|
||||||
.def("getMaximum", &Texture::getMaximum, BP_RETURN_VALUE)
|
.def("getMaximum", &Texture::getMaximum, BP_RETURN_VALUE)
|
||||||
.def("getResolution", &Texture::getResolution, BP_RETURN_VALUE)
|
.def("getResolution", &Texture::getResolution, BP_RETURN_VALUE)
|
||||||
.def("isConstant", &Texture::isConstant)
|
.def("isConstant", &Texture::isConstant)
|
||||||
.def("usesRayDifferentials", &Texture::usesRayDifferentials);
|
.def("isMonochromatic", &Texture::isMonochromatic)
|
||||||
|
.def("expand", &Texture::expand, BP_RETURN_VALUE)
|
||||||
|
.def("usesRayDifferentials", &Texture::usesRayDifferentials)
|
||||||
|
.def("getBitmap", &Texture::getBitmap, getBitmap_overloads()[BP_RETURN_VALUE]);
|
||||||
|
|
||||||
bp::class_<Noise>("Noise")
|
bp::class_<Noise>("Noise")
|
||||||
.def("perlinNoise", &Noise::perlinNoise)
|
.def("perlinNoise", &Noise::perlinNoise)
|
||||||
|
|
Loading…
Reference in New Issue