SceneNode的Owner改名为ParentNode,以及相关函数改名

This commit is contained in:
hyzboy 2025-03-25 01:22:20 +08:00
parent ee5d633596
commit 0b172bfc81

View File

@ -4,6 +4,7 @@
#include<hgl/type/IDName.h> #include<hgl/type/IDName.h>
#include<hgl/graph/SceneOrient.h> #include<hgl/graph/SceneOrient.h>
#include<hgl/graph/AABB.h> #include<hgl/graph/AABB.h>
#include<hgl/component/Component.h>
namespace hgl namespace hgl
{ {
@ -19,7 +20,7 @@ namespace hgl
*/ */
class SceneNode:public SceneOrient ///场景节点类 class SceneNode:public SceneOrient ///场景节点类
{ {
SceneNode *Owner; ///<上级节点 SceneNode *ParentNode; ///<上级节点
SceneNodeID NodeID; ///<节点ID SceneNodeID NodeID; ///<节点ID
SceneNodeName NodeName; ///<节点名称 SceneNodeName NodeName; ///<节点名称
@ -35,6 +36,7 @@ namespace hgl
protected: protected:
ObjectList<SceneNode> ChildNode; ///<子节点 ObjectList<SceneNode> ChildNode; ///<子节点
ObjectList<Component> ComponentList; ///<组件列表
public: public:
@ -61,7 +63,7 @@ namespace hgl
{ {
SceneOrient::Clear(); SceneOrient::Clear();
Owner=nullptr; ParentNode=nullptr;
BoundingBox.SetZero(); BoundingBox.SetZero();
LocalBoundingBox.SetZero(); LocalBoundingBox.SetZero();
@ -78,9 +80,9 @@ namespace hgl
return(true); return(true);
} }
void SetOwner(SceneNode *sn) {Owner=sn;} void SetParent(SceneNode *sn) {ParentNode=sn;}
SceneNode * GetOwner() noexcept{return Owner;} SceneNode * GetParent() noexcept{return ParentNode;}
const SceneNode * GetOwner()const noexcept{return Owner;} const SceneNode * GetParent()const noexcept{return ParentNode;}
void SetRenderable(Renderable *); void SetRenderable(Renderable *);
Renderable *GetRenderable() noexcept{return render_obj;} Renderable *GetRenderable() noexcept{return render_obj;}
@ -92,7 +94,7 @@ namespace hgl
return(nullptr); return(nullptr);
ChildNode.Add(sn); ChildNode.Add(sn);
sn->SetOwner(this); sn->SetParent(this);
return sn; return sn;
} }
@ -106,6 +108,10 @@ namespace hgl
virtual const AABB & GetBoundingBox ()const{return BoundingBox;} ///<取得绑定盒 virtual const AABB & GetBoundingBox ()const{return BoundingBox;} ///<取得绑定盒
virtual const AABB & GetLocalBoundingBox ()const{return LocalBoundingBox;} ///<取得本地坐标绑定盒 virtual const AABB & GetLocalBoundingBox ()const{return LocalBoundingBox;} ///<取得本地坐标绑定盒
// virtual const AABB & GetWorldBoundingBox ()const{return WorldBoundingBox;} ///<取得世界坐标绑定盒 // virtual const AABB & GetWorldBoundingBox ()const{return WorldBoundingBox;} ///<取得世界坐标绑定盒
public: //组件相关方法
};//class SceneNode };//class SceneNode
SceneNode *Duplication(SceneNode *); ///<复制一个场景节点 SceneNode *Duplication(SceneNode *); ///<复制一个场景节点