Skip to content

Commit

Permalink
fix crash when using a group without a surface array
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffamstutz committed Jan 25, 2023
1 parent 72b7d59 commit 6f97895
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions libs/helide/scene/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,25 @@ void Group::embreeSceneConstruct()
rtcReleaseScene(m_embreeScene);
m_embreeScene = rtcNewScene(deviceState()->embreeDevice);

uint32_t id = 0;
std::for_each(m_surfaceData->handlesBegin(),
m_surfaceData->handlesEnd(),
[&](Object *o) {
auto *s = (Surface *)o;
if (s && s->isValid()) {
m_surfaces.push_back(s);
rtcAttachGeometryByID(
m_embreeScene, s->geometry()->embreeGeometry(), id);
} else {
reportMessage(ANARI_SEVERITY_DEBUG,
"helide::Group rejecting invalid surface(%p) in building BLS",
s);
}
id++;
});
if (m_surfaceData) {
uint32_t id = 0;
std::for_each(m_surfaceData->handlesBegin(),
m_surfaceData->handlesEnd(),
[&](Object *o) {
auto *s = (Surface *)o;
if (s && s->isValid()) {
m_surfaces.push_back(s);
rtcAttachGeometryByID(
m_embreeScene, s->geometry()->embreeGeometry(), id);
} else {
reportMessage(ANARI_SEVERITY_DEBUG,
"helide::Group rejecting invalid surface(%p) in building BLS",
s);
}
id++;
});
}

m_objectUpdates.lastSceneConstruction = helium::newTimeStamp();
m_objectUpdates.lastSceneCommit = 0;
embreeSceneCommit();
Expand Down

0 comments on commit 6f97895

Please sign in to comment.