ULRE/inc/hgl/graph/RenderList.h

79 lines
1.8 KiB
C
Raw Normal View History

2019-05-25 00:50:04 +08:00
#ifndef HGL_GRAPH_RENDER_LIST_INCLUDE
#define HGL_GRAPH_RENDER_LIST_INCLUDE
#include<hgl/graph/vulkan/VK.h>
#include<hgl/graph/Camera.h>
2019-05-25 01:06:33 +08:00
#include<hgl/type/Color4f.h>
2019-05-25 00:50:04 +08:00
namespace hgl
{
namespace graph
{
class SceneNode;
struct UBOMatrixData
{
Matrix4f projection;
Matrix4f modelview;
Matrix4f mvp;
2019-05-25 01:06:33 +08:00
Matrix3f normal;
2019-05-25 00:50:04 +08:00
};//
struct UBOSkyLight
2019-05-25 01:06:33 +08:00
{
Color4f sun_color;
Vector3f alignas(16) sun_direction;
2019-05-25 00:50:04 +08:00
};//
class RenderList
{
vulkan::CommandBuffer *cmd_buf;
2019-05-25 01:06:33 +08:00
private:
2019-05-25 00:50:04 +08:00
2019-05-25 01:06:33 +08:00
Camera camera;
2019-05-25 00:50:04 +08:00
Frustum frustum;
2019-05-25 01:06:33 +08:00
private:
UBOMatrixData ubo_matrix;
UBOSkyLight ubo_skylight;
2019-05-25 00:50:04 +08:00
private:
List<const SceneNode *> SceneNodeList;
vulkan::Pipeline * last_pipeline;
vulkan::DescriptorSets *last_desc_sets;
vulkan::Renderable * last_renderable;
void Render(vulkan::RenderableInstance *,const Matrix4f &);
public:
RenderList()
{
cmd_buf=nullptr;
last_pipeline=nullptr;
last_desc_sets=nullptr;
last_renderable=nullptr;
}
~RenderList()=default;
void Add (const SceneNode *node) {if(node)SceneNodeList.Add(node);}
void Clear () {SceneNodeList.ClearData();}
void SetCamera(const Camera &);
2019-05-25 01:06:33 +08:00
void SetSkyLightColor(const Color4f &c,const Vector3f &d)
{
ubo_skylight.sun_color=c;
ubo_skylight.sun_direction=d;
}
2019-05-25 00:50:04 +08:00
bool Render();
};//class RenderList
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_RENDER_LIST_INCLUDE