在PrimitiveComponent/MeshComponent实现GetBoundingBox函数

This commit is contained in:
2025-07-08 01:30:02 +08:00
parent 13f4332af1
commit 2ab8528e86
5 changed files with 31 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
#pragma once
#include<hgl/component/SceneComponent.h>
#include<hgl/graph/AABB.h>
#include<hgl/graph/OBB.h>
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