From 126aa5e885ef82221d9957e465f187a37110c5c6 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Fri, 27 Sep 2013 15:40:53 +0200 Subject: [PATCH] libpython: initial support for emitters --- src/libpython/render.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/libpython/render.cpp b/src/libpython/render.cpp index 9b9f4bcf..be6d4c22 100644 --- a/src/libpython/render.cpp +++ b/src/libpython/render.cpp @@ -351,7 +351,45 @@ void export_render() { .def("serialize", triMesh_serialize2) .def("writeOBJ", &TriMesh::writeOBJ); - BP_CLASS(Sensor, ConfigurableObject, bp::no_init) // incomplete + Shape *(AbstractEmitter::*abstractemitter_getShape)(void) = &AbstractEmitter::getShape; + Medium *(AbstractEmitter::*abstractemitter_getMedium)(void) = &AbstractEmitter::getMedium; + + BP_CLASS(AbstractEmitter, ConfigurableObject, bp::no_init) + .def("getType", &AbstractEmitter::getType) + .def("setWorldTransform", &AbstractEmitter::setWorldTransform) + .def("getWorldTransform", &AbstractEmitter::getWorldTransform, BP_RETURN_VALUE) + .def("isOnSurface", &AbstractEmitter::isOnSurface) + .def("needsPositionSample", &AbstractEmitter::needsPositionSample) + .def("needsDirectionSample", &AbstractEmitter::needsDirectionSample) + .def("needsDirectSample", &AbstractEmitter::needsDirectSample) + .def("getDirectMeasure", &AbstractEmitter::getDirectMeasure) + .def("isDegenerate", &AbstractEmitter::isDegenerate) + .def("getShape", abstractemitter_getShape, BP_RETURN_VALUE) + .def("getMedium", abstractemitter_getMedium, BP_RETURN_VALUE) + .def("createShape", &AbstractEmitter::createShape, BP_RETURN_VALUE) + .def("getAABB", &AbstractEmitter::getAABB, BP_RETURN_VALUE); + + BP_SETSCOPE(AbstractEmitter_class); + bp::enum_("EEmitterType") + .value("EDeltaDirection,", AbstractEmitter::EDeltaDirection) + .value("EDeltaPosition,", AbstractEmitter::EDeltaPosition) + .value("EOnSurface,", AbstractEmitter::EOnSurface) + .export_values(); + BP_SETSCOPE(renderModule); + + BP_CLASS(Emitter, AbstractEmitter, bp::no_init) // incomplete + .def("eval", &Emitter::eval, BP_RETURN_VALUE) + .def("getSamplingWeight", &Emitter::getSamplingWeight) + .def("isEnvironmentEmitter", &Emitter::isEnvironmentEmitter) + .def("evalEnvironment", &Emitter::evalEnvironment, BP_RETURN_VALUE); + + BP_SETSCOPE(Emitter_class); + bp::enum_("EEmitterFlags") + .value("EEnvironmentEmitter,", Emitter::EEnvironmentEmitter) + .export_values(); + BP_SETSCOPE(renderModule); + + BP_CLASS(Sensor, AbstractEmitter, bp::no_init) // incomplete .def("getShutterOpen", &Sensor::getShutterOpen) .def("setShutterOpen", &Sensor::setShutterOpen) .def("getShutterOpenTime", &Sensor::getShutterOpenTime)