diff --git a/src/libpython/render.cpp b/src/libpython/render.cpp new file mode 100644 index 00000000..9c82f4f2 --- /dev/null +++ b/src/libpython/render.cpp @@ -0,0 +1,58 @@ +#include "base.h" +#include +#include +#include +#include + +using namespace mitsuba; + +void export_render() { + bp::object renderModule( + bp::handle<>(bp::borrowed(PyImport_AddModule("mitsuba.render")))); + bp::scope().attr("render") = renderModule; + PyObject *oldScope = bp::detail::current_scope; + + BP_SETSCOPE(renderModule); + + BP_CLASS(Scene, NetworkedObject, bp::init<>()) + .def(bp::init()) + .def(bp::init()) + .def(bp::init()) + .def("initialize", &Scene::initialize) + .def("preprocess", &Scene::preprocess) + .def("render", &Scene::render) + .def("postprocess", &Scene::postprocess) + .def("flush", &Scene::flush) + .def("cancel", &Scene::cancel) + .def("getAABB", &Scene::getAABB, BP_RETURN_VALUE) + .def("getBSphere", &Scene::getBSphere, BP_RETURN_VALUE) + .def("getBlockSize", &Scene::getBlockSize) + .def("setBlockSize", &Scene::setBlockSize) + .def("getSourceFile", &Scene::getSourceFile, BP_RETURN_VALUE) + .def("setSourceFile", &Scene::setSourceFile) + .def("getDestinationFile", &Scene::getDestinationFile, BP_RETURN_VALUE) + .def("setDestinationFile", &Scene::setDestinationFile) + .def("destinationExists", &Scene::destinationExists); + + bp::class_("SceneHandler", bp::no_init) + .def("loadScene", &SceneHandler::loadScene, BP_RETURN_VALUE) + .staticmethod("loadScene"); + + BP_CLASS(RenderJob, Thread, (bp::init())) + .def(bp::init()) + .def(bp::init()) + .def(bp::init()) + .def("flush", &RenderJob::flush) + .def("cancel", &RenderJob::cancel) + .def("wait", &RenderJob::wait); + + BP_CLASS(RenderQueue, Object, bp::init<>()) + .def("getJobCount", &RenderQueue::getJobCount) + .def("addJob", &RenderQueue::addJob) + .def("removeJob", &RenderQueue::removeJob) + .def("waitLeft", &RenderQueue::waitLeft) + .def("join", &RenderQueue::join) + .def("flush", &RenderQueue::flush); + + bp::detail::current_scope = oldScope; +}