SceneNode only support a renderable instance.
This commit is contained in:
parent
4108eaa342
commit
46f006f470
@ -28,14 +28,19 @@ namespace hgl
|
|||||||
|
|
||||||
ObjectList<SceneNode> SubNode; ///<子节点
|
ObjectList<SceneNode> SubNode; ///<子节点
|
||||||
|
|
||||||
List<RenderableInstance *> renderable_instances; ///<可渲染实例
|
RenderableInstance *renderable_instances; ///<可渲染实例
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SceneNode()=default;
|
SceneNode()
|
||||||
SceneNode(const Matrix4f &mat)
|
{
|
||||||
|
renderable_instances=nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
SceneNode(const Matrix4f &mat,RenderableInstance *ri=nullptr)
|
||||||
{
|
{
|
||||||
SetLocalMatrix(mat);
|
SetLocalMatrix(mat);
|
||||||
|
renderable_instances=ri;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~SceneNode()
|
virtual ~SceneNode()
|
||||||
@ -59,21 +64,18 @@ namespace hgl
|
|||||||
return sn;
|
return sn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Add(SceneNode *n){if(n)SubNode.Add(n);} ///<增加一个子节点
|
void AddSubNode(SceneNode *n){if(n)SubNode.Add(n);} ///<增加一个子节点
|
||||||
void ClearSubNode(){SubNode.ClearData();} ///<清除子节点
|
void ClearSubNode(){SubNode.ClearData();} ///<清除子节点
|
||||||
|
|
||||||
void Add(RenderableInstance *ri){if(ri)renderable_instances.Add(ri);} ///<增加渲染实例
|
void Set(RenderableInstance *ri){renderable_instances=ri;} ///<增加渲染实例
|
||||||
|
|
||||||
void Add(RenderableInstance *ri,const Matrix4f &mat)
|
void Set(const Matrix4f &mat,RenderableInstance *ri)
|
||||||
{
|
{
|
||||||
SceneNode *sn=new SceneNode(mat);
|
SetLocalMatrix(mat);
|
||||||
|
|
||||||
sn->Add(ri);
|
renderable_instances=ri;
|
||||||
SubNode.Add(sn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearRenderableInstance(){renderable_instances.ClearData();} ///<清除渲染实例
|
|
||||||
|
|
||||||
public: //坐标相关方法
|
public: //坐标相关方法
|
||||||
|
|
||||||
virtual void SetBoundingBox (const AABB &bb){BoundingBox=bb;} ///<设置绑定盒
|
virtual void SetBoundingBox (const AABB &bb){BoundingBox=bb;} ///<设置绑定盒
|
||||||
@ -88,14 +90,6 @@ namespace hgl
|
|||||||
virtual const Vector4f & GetCenter ()const{return Center;} ///<取得中心点
|
virtual const Vector4f & GetCenter ()const{return Center;} ///<取得中心点
|
||||||
virtual const Vector4f & GetLocalCenter ()const{return LocalCenter;} ///<取得本地坐标中心点
|
virtual const Vector4f & GetLocalCenter ()const{return LocalCenter;} ///<取得本地坐标中心点
|
||||||
virtual const Vector4f & GetWorldCenter ()const{return WorldCenter;} ///<取得世界坐标中心点
|
virtual const Vector4f & GetWorldCenter ()const{return WorldCenter;} ///<取得世界坐标中心点
|
||||||
|
|
||||||
public: //渲染列表相关方法
|
|
||||||
|
|
||||||
virtual bool ExpendToList(RenderList *,FilterSceneNodeFunc func=nullptr,void *func_data=nullptr); ///<展开到渲染列表
|
|
||||||
bool ExpendToList(RenderList *rl,Frustum *f) ///<展开到渲染列表(使用平截头裁剪)
|
|
||||||
{return ExpendToList(rl,FrustumClipFilter,f);}
|
|
||||||
|
|
||||||
bool ExpendToList(RenderList *,Camera *,RenderListCompFunc=nullptr); ///<展开到渲染列表(使用摄像机平截头裁剪并排序)
|
|
||||||
};//class SceneNode
|
};//class SceneNode
|
||||||
}//namespace graph
|
}//namespace graph
|
||||||
}//namespace hgl
|
}//namespace hgl
|
||||||
|
@ -48,7 +48,7 @@ namespace hgl
|
|||||||
{
|
{
|
||||||
if(!sn)return(false);
|
if(!sn)return(false);
|
||||||
|
|
||||||
if(sn->renderable_instances.GetCount()>0)
|
if(sn->renderable_instances)
|
||||||
scene_node_list->Add(sn);
|
scene_node_list->Add(sn);
|
||||||
|
|
||||||
for(SceneNode *sub:sn->SubNode)
|
for(SceneNode *sub:sn->SubNode)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user