From d416507548fa6c885f0b96ef621e1b7a35f3147e Mon Sep 17 00:00:00 2001 From: Stefan Zellmann Date: Wed, 15 May 2024 11:02:53 +0200 Subject: [PATCH] Implement group bounds property --- scene/Group.cpp | 20 +++++--------------- scene/Group.h | 2 -- scene/surface/geometry/Geometry.cpp | 1 - 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/scene/Group.cpp b/scene/Group.cpp index fa7b9b53..082a4e72 100644 --- a/scene/Group.cpp +++ b/scene/Group.cpp @@ -30,13 +30,11 @@ bool Group::getProperty( visionaraySceneConstruct(); visionaraySceneCommit(); } - // auto bounds = getEmbreeSceneBounds(m_embreeScene); - // for (auto *v : volumes()) { - // if (v->isValid()) - // bounds.extend(v->bounds()); - // } - // std::memcpy(ptr, &bounds, sizeof(bounds)); - return true; + if (vscene && vscene->isValid()) { + auto bounds = vscene->getBounds(); + std::memcpy(ptr, &bounds, sizeof(bounds)); + return true; + } } return Object::getProperty(name, type, ptr, flags); @@ -211,14 +209,6 @@ void Group::cleanup() vscene = nullptr; } -// box3 getEmbreeSceneBounds(RTCScene scene) -// { -// RTCBounds eb; -// rtcGetSceneBounds(scene, &eb); -// return box3({eb.lower_x, eb.lower_y, eb.lower_z}, -// {eb.upper_x, eb.upper_y, eb.upper_z}); -// } - } // namespace visionaray VISIONARAY_ANARI_TYPEFOR_DEFINITION(visionaray::Group *); diff --git a/scene/Group.h b/scene/Group.h index 685eaf27..bdc14ffd 100644 --- a/scene/Group.h +++ b/scene/Group.h @@ -64,8 +64,6 @@ struct Group : public Object VisionarayScene vscene{nullptr}; }; -// box3 getEmbreeSceneBounds(RTCScene scene); - } // namespace visionaray VISIONARAY_ANARI_TYPEFOR_SPECIALIZATION(visionaray::Group *, ANARI_GROUP); diff --git a/scene/surface/geometry/Geometry.cpp b/scene/surface/geometry/Geometry.cpp index ccea6b66..3298a7a2 100644 --- a/scene/surface/geometry/Geometry.cpp +++ b/scene/surface/geometry/Geometry.cpp @@ -28,7 +28,6 @@ Geometry::~Geometry() { deviceState()->dcos.geometries.free(vgeom.geomID); -// rtcReleaseGeometry(m_embreeGeometry); deviceState()->objectCounts.geometries--; }