SceneTreeToRenderList

This commit is contained in:
2021-02-05 17:15:16 +08:00
parent 07c761eab9
commit 4108eaa342
3 changed files with 82 additions and 5 deletions

View File

@@ -5,12 +5,15 @@
#include<hgl/graph/Camera.h>
#include<hgl/graph/SceneNode.h>
#include<hgl/type/Color4f.h>
#include<hgl/type/Sets.h>
namespace hgl
{
namespace graph
{
struct MVPArray;
using SceneNodeList=List<SceneNode *>;
class RenderList
{
GPUDevice *device;
@@ -22,7 +25,7 @@ namespace hgl
MVPArray *mvp_array;
List<SceneNode *> scene_node_list;
SceneNodeList *scene_node_list;
Pipeline * last_pipeline;
RenderableInstance *last_ri;
@@ -49,20 +52,40 @@ namespace hgl
class SceneTreeToRenderList
{
using PipelineSets=Sets<Pipeline *>;
using MaterialSets=Sets<Material *>;
using MatInstanceSets=Sets<MaterialInstance *>;
protected:
GPUDevice *device;
public:
protected:
Camera * camera;
CameraMatrix * camera_matrix;
Frustum frustum;
public:
protected:
SceneNodeList * scene_node_list; ///<场景节点列表
PipelineSets pipeline_sets; ///<管线合集
MaterialSets material_sets; ///<材质合集
MatInstanceSets mat_instance_sets; ///<材质实例合集
RenderList * render_list;
protected:
virtual uint32 CameraLength(SceneNode *,SceneNode *); ///<摄像机距离比较函数
virtual bool InFrustum(const SceneNode *,void *); ///<平截头截剪函数
virtual bool Begin();
virtual bool Expend(SceneNode *);
virtual bool End();
public:
SceneTreeToRenderList(GPUDevice *d)
@@ -70,8 +93,13 @@ namespace hgl
device=d;
camera=nullptr;
camera_matrix=nullptr;
scene_node_list=nullptr;
render_list=nullptr;
}
virtual ~SceneTreeToRenderList();
virtual bool Expend(RenderList *,Camera *,SceneNode *);
};//class SceneTreeToRenderList
}//namespace graph