used protected scope it's render_obj of SceneNode

This commit is contained in:
2021-06-15 19:02:51 +08:00
parent 32d895136b
commit b86eadddb7
3 changed files with 52 additions and 5 deletions

View File

@@ -24,12 +24,12 @@ namespace hgl
Vector4f Center; ///<中心点
Vector4f LocalCenter; ///<本地坐标中心点
Vector4f WorldCenter; ///<世界坐标中心点
RenderableInstance *render_obj=nullptr; ///<可渲染实例
public:
ObjectList<SceneNode> SubNode; ///<子节点
RenderableInstance *render_obj=nullptr; ///<可渲染实例
public:
@@ -38,7 +38,7 @@ namespace hgl
SceneNode(const Matrix4f &mat ):SceneOrient(mat) {}
SceneNode(const Matrix4f &mat, RenderableInstance *ri ):SceneOrient(mat) {render_obj=ri;}
virtual ~SceneNode(){}
virtual ~SceneNode()=default;
void Clear()
{
@@ -46,6 +46,33 @@ namespace hgl
render_obj=nullptr;
}
RenderableInstance *GetRI(){return render_obj;}
void SetRI(RenderableInstance *);
SceneNode *CreateSubNode()
{
SceneNode *sn=new SceneNode();
SubNode.Add(sn);
return sn;
}
SceneNode *CreateSubNode(const Matrix4f &mat)
{
SceneNode *sn=new SceneNode(mat);
SubNode.Add(sn);
return sn;
}
SceneNode *CreateSubNode(const Matrix4f &mat,RenderableInstance *ri)
{
SceneNode *sn=new SceneNode(mat,ri);
SubNode.Add(sn);
return sn;
}
public: //坐标相关方法
virtual void SetBoundingBox (const AABB &bb){BoundingBox=bb;} ///<设置绑定盒