Commit 232ef1d0 authored by Carson Brownlee's avatar Carson Brownlee
Browse files

fixing ospray bug with multiple geometries

parent e357516a
......@@ -1203,6 +1203,22 @@ void vtkOSPRayPolyDataMapperNode::ORenderPoly(void* renderer, vtkOSPRayActorNode
{
ospRelease(mat);
}
for (auto g : this->GeometricModels)
{
OSPGroup group = ospNewGroup();
OSPInstance instance = ospNewInstance(group); // valgrind reports instance is lost
ospCommit(instance);
ospRelease(group);
OSPData data = ospNewCopyData1D(1, OSP_GEOMETRIC_MODEL, &g);
ospRelease(&(*g));
ospCommit(data);
ospSetObject(group, "geometry", data);
ospCommit(group);
ospRelease(data);
this->Instances.emplace_back(instance);
}
this->GeometricModels.clear();
}
//----------------------------------------------------------------------------
......@@ -1339,22 +1355,10 @@ void vtkOSPRayPolyDataMapperNode::RenderGeometricModels()
}
return;
}
for (auto g : this->GeometricModels)
for (auto instance : this->Instances)
{
OSPGroup group = ospNewGroup();
OSPInstance instance = ospNewInstance(group); // valgrind reports instance is lost
ospCommit(instance);
ospRelease(group);
OSPData data = ospNewCopyData1D(1, OSP_GEOMETRIC_MODEL, &g);
ospRelease(&(*g));
ospCommit(data);
ospSetObject(group, "geometry", data);
ospCommit(group);
ospRelease(data);
orn->Instances.emplace_back(instance);
this->Instances.emplace_back(instance);
}
this->GeometricModels.clear();
}
//----------------------------------------------------------------------------
......@@ -1365,6 +1369,7 @@ void vtkOSPRayPolyDataMapperNode::ClearGeometricModels()
RTW::Backend* backend = orn->GetBackend();
this->GeometricModels.clear();
for (auto instance : this->Instances)
ospRelease(&(*instance));
this->Instances.clear();
}
......@@ -1090,10 +1090,6 @@ void vtkOSPRayRendererNode::Traverse(int operation)
bool enable_cache = true; // turn off to force rebuilds for debugging
if (!enable_cache || (recent > this->RenderTime) || (numAct != this->NumActors))
{
for (auto i : this->Instances)
{
ospRelease(&(*i));
}
this->Instances.clear();
this->NumActors = numAct;
it->InitTraversal();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment