add a new Scene::invalidate() function to address an issue reported by David Harmon

metadata
Wenzel Jakob 2014-07-23 19:55:12 +02:00
parent 455b239c15
commit ae865e7dfa
3 changed files with 14 additions and 0 deletions

View File

@ -72,6 +72,14 @@ public:
*/
void initialize();
/**
*\brief Invalidate the kd-tree
*
* This function must be called if, after running \ref initialize(),
* additional geometry is added to the scene.
*/
void invalidate();
/**
* \brief Initialize the scene for bidirectional rendering algorithms.
*

View File

@ -330,6 +330,7 @@ void export_render() {
.def("getPrimitiveCount", &ShapeKDTree::getPrimitiveCount)
.def("addShape", &ShapeKDTree::addShape)
.def("build", &ShapeKDTree::build)
.def("isBuilt", &ShapeKDTree::isBuilt)
.def("getAABB", &shapekdtree_getAABB, BP_RETURN_VALUE)
.def("getShapes", &shapekdtree_getShapes)
.def("rayIntersect", &shapekdtree_rayIntersect);
@ -343,6 +344,7 @@ void export_render() {
.def(bp::init<Scene *>())
.def(bp::init<Stream *, InstanceManager *>())
.def("initialize", &Scene::initialize)
.def("invalidate", &Scene::invalidate)
.def("preprocess", &Scene::preprocess)
.def("render", &Scene::render)
.def("postprocess", &Scene::postprocess)

View File

@ -315,6 +315,10 @@ void Scene::configure() {
m_integrator->configureSampler(this, m_sampler);
}
void Scene::invalidate() {
m_kdtree = new ShapeKDTree();
}
void Scene::initialize() {
if (!m_kdtree->isBuilt()) {
/* Expand all geometry */