splite RenderNode2D/3D,RenderList2D/3D
This commit is contained in:
@@ -31,7 +31,7 @@ namespace hgl
|
||||
RenderNodeList render_node_list; ///<场景节点列表
|
||||
MaterialSets material_sets; ///<材质合集
|
||||
|
||||
RenderNodeComparator render_node_comparator;
|
||||
RenderNodeComparator *render_node_comparator;
|
||||
|
||||
private:
|
||||
|
||||
@@ -69,6 +69,19 @@ namespace hgl
|
||||
|
||||
class RenderList2D:public RenderList
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool Begin() override;
|
||||
virtual bool Expend(SceneNode *) override;
|
||||
virtual void End() override;
|
||||
|
||||
public:
|
||||
|
||||
RenderList2D();
|
||||
virtual ~RenderList2D() override;
|
||||
|
||||
virtual bool Expend(SceneNode *);
|
||||
};
|
||||
|
||||
class RenderList3D:public RenderList
|
||||
@@ -88,6 +101,8 @@ namespace hgl
|
||||
|
||||
RenderList3D();
|
||||
virtual ~RenderList3D() override;
|
||||
|
||||
bool Expend(const CameraInfo &,SceneNode *);
|
||||
};
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
109
inc/hgl/graph/RenderList2D.h
Normal file
109
inc/hgl/graph/RenderList2D.h
Normal file
@@ -0,0 +1,109 @@
|
||||
#ifndef HGL_GRAPH_RENDER_LIST_INCLUDE
|
||||
#define HGL_GRAPH_RENDER_LIST_INCLUDE
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/graph/Camera.h>
|
||||
#include<hgl/graph/SceneNode.h>
|
||||
#include<hgl/graph/RenderNode.h>
|
||||
#include<hgl/graph/VKArrayBuffer.h>
|
||||
#include<hgl/graph/SceneInfo.h>
|
||||
#include<hgl/color/Color4f.h>
|
||||
#include<hgl/type/SortedSets.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
using MaterialSets=SortedSets<Material *>;
|
||||
|
||||
/**
|
||||
* 渲染对象列表<br>
|
||||
* 已经展开的渲染对象列表,产生mvp用UBO/SSBO等数据,最终创建RenderCommandBuffer
|
||||
*/
|
||||
class RenderList
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUDevice * device;
|
||||
RenderCmdBuffer *cmd_buf;
|
||||
|
||||
private:
|
||||
|
||||
RenderNodeList render_node_list; ///<场景节点列表
|
||||
MaterialSets material_sets; ///<材质合集
|
||||
|
||||
RenderNodeComparator *render_node_comparator;
|
||||
|
||||
private:
|
||||
|
||||
List<Renderable *> ri_list;
|
||||
|
||||
VkDescriptorSet ds_list[DESCRIPTOR_SET_TYPE_COUNT];
|
||||
DescriptorSet *renderable_desc_sets;
|
||||
|
||||
uint32_t ubo_offset;
|
||||
uint32_t ubo_align;
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool Begin();
|
||||
virtual bool Expend(SceneNode *);
|
||||
virtual void End();
|
||||
|
||||
private:
|
||||
|
||||
Pipeline * last_pipeline;
|
||||
MaterialParameters *last_mp[DESCRIPTOR_SET_TYPE_COUNT];
|
||||
uint32_t last_vbo;
|
||||
|
||||
void Render(Renderable *);
|
||||
|
||||
public:
|
||||
|
||||
RenderList(GPUDevice *);
|
||||
virtual ~RenderList();
|
||||
|
||||
virtual bool Expend(const CameraInfo &,SceneNode *);
|
||||
|
||||
virtual bool Render(RenderCmdBuffer *);
|
||||
};//class RenderList
|
||||
|
||||
class RenderList2D:public RenderList
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool Begin() override;
|
||||
virtual bool Expend(SceneNode *) override;
|
||||
virtual void End() override;
|
||||
|
||||
public:
|
||||
|
||||
RenderList2D();
|
||||
virtual ~RenderList2D() override;
|
||||
|
||||
virtual bool Expend(SceneNode *);
|
||||
};
|
||||
|
||||
class RenderList3D:public RenderList
|
||||
{
|
||||
protected:
|
||||
|
||||
CameraInfo camera_info;
|
||||
GPUArrayBuffer *mvp_array;
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool Begin() override;
|
||||
virtual bool Expend(SceneNode *) override;
|
||||
virtual void End() override;
|
||||
|
||||
public:
|
||||
|
||||
RenderList3D();
|
||||
virtual ~RenderList3D() override;
|
||||
|
||||
bool Expend(const CameraInfo &,SceneNode *);
|
||||
};
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_RENDER_LIST_INCLUDE
|
@@ -10,14 +10,17 @@ namespace hgl
|
||||
{
|
||||
class Renderable;
|
||||
|
||||
struct RenderNode
|
||||
constexpr double RenderNode3DDistanceFactor=100.0;
|
||||
|
||||
struct RenderNode3D
|
||||
{
|
||||
MVPMatrix matrix;
|
||||
|
||||
Vector3f WorldCenter;
|
||||
|
||||
float distance_to_camera_square;
|
||||
// float distance_to_camera;
|
||||
double distance_to_camera_square;
|
||||
|
||||
double distance_to_camera;
|
||||
|
||||
Renderable *ri;
|
||||
|
||||
@@ -29,11 +32,10 @@ namespace hgl
|
||||
virtual const uint32 GetUBOBytes()const{return sizeof(MVPMatrix);}
|
||||
};//struct RenderNode
|
||||
|
||||
using RenderNodeList=List<RenderNode *>;
|
||||
using RenderNode3DList=List<RenderNode3D *>;
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
||||
using RenderNodePointer=hgl::graph::RenderNode *;
|
||||
using RenderNodeComparator=Comparator<RenderNodePointer>;
|
||||
|
||||
using RenderNode3DPointer=hgl::graph::RenderNode3D *;
|
||||
using RenderNode3DComparator=Comparator<RenderNode3DPointer>;
|
||||
#endif//HGL_GRAPH_RENDER_NODE_INCLUDE
|
||||
|
38
inc/hgl/graph/RenderNode2D.h
Normal file
38
inc/hgl/graph/RenderNode2D.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef HGL_GRAPH_RENDER_NODE_2D_INCLUDE
|
||||
#define HGL_GRAPH_RENDER_NODE_2D_INCLUDE
|
||||
|
||||
#include<hgl/math/Vector.h>
|
||||
#include<hgl/type/List.h>
|
||||
#include<hgl/graph/SceneInfo.h>
|
||||
namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
class Renderable;
|
||||
|
||||
struct Transiton2D
|
||||
{
|
||||
Vector2f move;
|
||||
Vector2f center; //中心点
|
||||
|
||||
//下方的不管是缩放还是旋转,均以上面的center为中心变换
|
||||
|
||||
Vector2f scale;
|
||||
float rotate;
|
||||
float z;
|
||||
};
|
||||
|
||||
struct RenderNode2D
|
||||
{
|
||||
Transiton2D trans;
|
||||
|
||||
Renderable *ri;
|
||||
};
|
||||
|
||||
using RenderNode2DList=List<RenderNode2D *>;
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
||||
using RenderNode2DPointer=hgl::graph::RenderNode2D *;
|
||||
using RenderNode2DComparator=Comparator<RenderNode2DPointer>;
|
||||
#endif//HGL_GRAPH_RENDER_NODE_2D_INCLUDE
|
@@ -32,11 +32,9 @@ public:
|
||||
|
||||
const uint32_t GetDescriptorCount ()const{return desc_manager->GetBindCount(set_type);} ///<获取总共需要绑定的描述符数量
|
||||
|
||||
const uint32_t GetDynamicCount ()const
|
||||
const uint32_t GetDynamicCount ()const //返回动态ubo/ssbo总量
|
||||
{
|
||||
//返回动态ubo/ssbo总量
|
||||
|
||||
//考虑将
|
||||
}
|
||||
|
||||
const uint32_t GetBoundCount ()const{return descriptor_set->GetCount();} ///<获取已经绑好的数量
|
||||
|
Reference in New Issue
Block a user