From 92721ef0a3aba3706f73bdfa0294432e7f769225 Mon Sep 17 00:00:00 2001 From: Ansgar Philippsen <ansgar.philippsen@gmail.com> Date: Thu, 16 Aug 2012 15:12:17 -0400 Subject: [PATCH] fixed wrong BoundingBox for PrimList and MapSlab --- modules/gfx/src/entity.hh | 2 +- modules/gfx/src/map_slab.cc | 5 +++-- modules/gfx/src/map_slab.hh | 2 +- modules/gfx/src/prim_list.cc | 5 +++-- modules/gfx/src/prim_list.hh | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/modules/gfx/src/entity.hh b/modules/gfx/src/entity.hh index 112a7ac4d..d3fe0ad92 100644 --- a/modules/gfx/src/entity.hh +++ b/modules/gfx/src/entity.hh @@ -90,7 +90,7 @@ public: RenderMode::Type m, const mol::EntityView& ev); - virtual geom::AlignedCuboid GetBoundingBox(bool use_global=false) const; + virtual geom::AlignedCuboid GetBoundingBox(bool use_tf=false) const; // ProcessLimits uses the default implementation of bounding box diff --git a/modules/gfx/src/map_slab.cc b/modules/gfx/src/map_slab.cc index ae4a08629..3af16f422 100644 --- a/modules/gfx/src/map_slab.cc +++ b/modules/gfx/src/map_slab.cc @@ -84,11 +84,12 @@ MapSlab::MapSlab(const String& name, const img::MapHandle& mh, const geom::Plane maxv_ = stat.GetMaximum(); } -geom::AlignedCuboid MapSlab::GetBoundingBox() const +geom::AlignedCuboid MapSlab::GetBoundingBox(bool use_tf) const { geom::Vec3 minc = plane_.At(-1.0,-1.0); geom::Vec3 maxc = plane_.At(1.0,1.0); - return geom::AlignedCuboid(minc,maxc); + geom::AlignedCuboid bb(minc,maxc); + return use_tf ? transform_.Apply(bb) : bb; } geom::Vec3 MapSlab::GetCenter() const diff --git a/modules/gfx/src/map_slab.hh b/modules/gfx/src/map_slab.hh index 8d27b975c..c38a88864 100644 --- a/modules/gfx/src/map_slab.hh +++ b/modules/gfx/src/map_slab.hh @@ -62,7 +62,7 @@ public: MapSlab(const String& name, const img::MapHandle& mh, const geom::Plane& p); - virtual geom::AlignedCuboid GetBoundingBox() const; + virtual geom::AlignedCuboid GetBoundingBox(bool use_tf=true) const; virtual geom::Vec3 GetCenter() const; virtual void CustomRenderGL(RenderPass pass); diff --git a/modules/gfx/src/prim_list.cc b/modules/gfx/src/prim_list.cc index e07820e6b..0c8589ea2 100644 --- a/modules/gfx/src/prim_list.cc +++ b/modules/gfx/src/prim_list.cc @@ -54,7 +54,7 @@ void PrimList::Clear() this->FlagRebuild(); } -geom::AlignedCuboid PrimList::GetBoundingBox() const +geom::AlignedCuboid PrimList::GetBoundingBox(bool use_tf) const { if(points_.empty() && lines_.empty() && spheres_.empty() && cyls_.empty() && texts_.empty() && vas_.empty()) { return geom::AlignedCuboid(geom::Vec3(-1,-1,-1),geom::Vec3(1,1,1)); @@ -66,7 +66,8 @@ geom::AlignedCuboid PrimList::GetBoundingBox() const -std::numeric_limits<float>::max(), -std::numeric_limits<float>::max()); ProcessLimits(minc,maxc,geom::Transform()); - return geom::AlignedCuboid(minc,maxc); + geom::AlignedCuboid bb(minc,maxc); + return use_tf ? transform_.Apply(bb) : bb; } void PrimList::ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, diff --git a/modules/gfx/src/prim_list.hh b/modules/gfx/src/prim_list.hh index afc999a7f..80eabe333 100644 --- a/modules/gfx/src/prim_list.hh +++ b/modules/gfx/src/prim_list.hh @@ -61,7 +61,7 @@ class DLLEXPORT_OST_GFX PrimList: public GfxObj /// \brief create new prim list PrimList(const String& name); - virtual geom::AlignedCuboid GetBoundingBox() const; + virtual geom::AlignedCuboid GetBoundingBox(bool use_tf=true) const; virtual void ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, const geom::Transform& tf) const; -- GitLab