diff --git a/CMCore b/CMCore index 8e733a24..6b97ffdf 160000 --- a/CMCore +++ b/CMCore @@ -1 +1 @@ -Subproject commit 8e733a241536efcaff8cbff66c8a3a4f1255ed86 +Subproject commit 6b97ffdf79ff978fff89ca5276a21c1a18c98669 diff --git a/CMSceneGraph b/CMSceneGraph index 1e7e4a02..584ac021 160000 --- a/CMSceneGraph +++ b/CMSceneGraph @@ -1 +1 @@ -Subproject commit 1e7e4a025cdd03125144e167b62f70a8efdaf245 +Subproject commit 584ac02106791566f6df9a45ccd0678f333efbc7 diff --git a/example/Basic/RenderBoundBox.cpp b/example/Basic/RenderBoundBox.cpp index 65af266e..53fced5d 100644 --- a/example/Basic/RenderBoundBox.cpp +++ b/example/Basic/RenderBoundBox.cpp @@ -231,7 +231,7 @@ private: CreateComponentInfo cci(GetSceneRoot()); { - cci.mat=scale(10,10,1); + cci.mat=ScaleMatrix(10,10,1); rm_plane->component=CreateComponent(&cci,rm_plane->cdp); } @@ -250,7 +250,7 @@ private: { CreateComponentInfo cci(GetSceneRoot()); - cci.mat=rm_torus->component->GetLocalMatrix(); + //cci.mat=rm_torus->component->GetLocalMatrix()*rm_torus->component->GetMesh()->GetBoundingBox(); CreateComponent(&cci,rm_box->cdp); diff --git a/inc/hgl/component/MeshComponent.h b/inc/hgl/component/MeshComponent.h index e1fd60e9..d10d0469 100644 --- a/inc/hgl/component/MeshComponent.h +++ b/inc/hgl/component/MeshComponent.h @@ -101,6 +101,17 @@ public: return mcd->mesh; } + const bool GetBoundingBox(AABB &box) const override + { + Mesh *mesh=GetMesh(); + + if (!mesh) + return false; + + box=mesh->GetBoundingBox(); + return true; + } + public: Pipeline *GetPipeline() const diff --git a/inc/hgl/component/PrimitiveComponent.h b/inc/hgl/component/PrimitiveComponent.h index 38452530..678f1750 100644 --- a/inc/hgl/component/PrimitiveComponent.h +++ b/inc/hgl/component/PrimitiveComponent.h @@ -1,6 +1,8 @@ #pragma once #include +#include +#include COMPONENT_NAMESPACE_BEGIN @@ -15,6 +17,20 @@ public: using SceneComponent::SceneComponent; virtual ~PrimitiveComponent()=default; + + virtual const bool GetBoundingBox(AABB &box) const =0; + + const bool GetBoundingBox(OBB &box) + { + AABB aabb; + + if(!GetBoundingBox(aabb)) + return false; + + box.Set(GetLocalToWorldMatrix(),aabb); + + return true; + } };//class PrimitiveComponent COMPONENT_NAMESPACE_END