preparing RenderFramework
This commit is contained in:
parent
2c67990daa
commit
59b3ec6bf3
2
CMCore
2
CMCore
@ -1 +1 @@
|
||||
Subproject commit 09d777261f4249ccdba5bef44d794742f4e3237a
|
||||
Subproject commit ca8517f146b08bb4df1669218579223ac7bfbcae
|
73
inc/hgl/graph/LightingModel.h
Normal file
73
inc/hgl/graph/LightingModel.h
Normal file
@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
enum class LightingModel:uint8
|
||||
{
|
||||
Unlit,
|
||||
|
||||
Gizmo, ///<Gizmo专用(Blinnphong的特定版本,内置假的太阳光方向、高光系数等,使其不需要外部UBO传入)
|
||||
|
||||
Blinnphong, ///<Blinnphong光照模型
|
||||
|
||||
FakePBR, ///<假PBR(使用Blinnphong+HalfLambert模拟)
|
||||
MicroPBR, ///<微型PBR(只有BaseColor/Normal/Metallic/Roughness四个基础数据的PBR)
|
||||
|
||||
WebPBR, ///<Khronos为WebGL提供的PBR
|
||||
FilamentPBR, ///<Filament引擎所提供的PBR
|
||||
AMDPBR, ///<AMD Caulrdon框架所提供的PBR
|
||||
|
||||
BlenderPBR, ///<Blender所提供的PBR
|
||||
|
||||
ENUM_CLASS_RANGE(Unlit,BlenderPBR)
|
||||
};//enum class LightingModel:uint8
|
||||
|
||||
constexpr const char *LightingModelName[]=
|
||||
{
|
||||
"Unlit",
|
||||
|
||||
"Gizmo",
|
||||
|
||||
"Blinnphong",
|
||||
|
||||
"FakePBR",
|
||||
"MicroPBR",
|
||||
|
||||
"WebPBR",
|
||||
"FilamentPBR",
|
||||
"AMDPBR",
|
||||
|
||||
"BlenderPBR"
|
||||
};
|
||||
|
||||
/**
|
||||
* 天光来源
|
||||
*/
|
||||
enum class SkyLightSource:uint8
|
||||
{
|
||||
PureColor, ///<纯色
|
||||
GradientColor, ///<过渡色
|
||||
Cubemap, ///<立方体贴图
|
||||
IBL, ///<IBL立方体贴图
|
||||
|
||||
ENUM_CLASS_RANGE(PureColor,IBL)
|
||||
};//enum class SkyLightSource:uint8
|
||||
|
||||
/**
|
||||
* 环境光来源
|
||||
*/
|
||||
enum class AmbientLightSource:uint8
|
||||
{
|
||||
PureColor, ///<纯色
|
||||
|
||||
Distance, ///<距离(用于显示深邃场景,比如峡谷、深井、管道,越远越黑。理论等同AO)
|
||||
|
||||
LightProbe, ///<光线探针(也许也是Cubemap,也许不是)
|
||||
|
||||
Cubemap, ///<本地Cubemap
|
||||
|
||||
};//enum class AmbientLightSource:uint8
|
||||
|
||||
VK_NAMESPACE_END
|
120
inc/hgl/graph/RenderFramework.h
Normal file
120
inc/hgl/graph/RenderFramework.h
Normal file
@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/type/List.h>
|
||||
#include<hgl/graph/ViewportInfo.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class RenderModule;
|
||||
|
||||
/**
|
||||
* 光照剔除模式
|
||||
*/
|
||||
enum class LightingCullingMode
|
||||
{
|
||||
None, ///<不剔除
|
||||
|
||||
/*
|
||||
* 基于Tile的剔除模式
|
||||
* 按屏幕XY坐标划分成多个Tile,再配合znear/zfar形成一个Volume。所有光源和Volume计算相交性
|
||||
*/
|
||||
Tile, ///<瓦片剔除
|
||||
|
||||
/**
|
||||
* 基于Tile的剔除模式的改进型
|
||||
* 同Tile方法,得出Tile后,再通过Compute Shader遍历Tile内所有象素,得出当前Tile的最远z值和最近z值。
|
||||
* 根据XY与zNear/zFar得出一个Volume,计算所有光源与Volume相交性。
|
||||
*/
|
||||
TileVolume, ///<瓦片体积剔除
|
||||
|
||||
/**
|
||||
* 基于Tile的剔除模式的改进型
|
||||
* 同TileVolume方法得出Volume后,再将Volume按深度划分成多个Volume。
|
||||
* 剔除掉没有象素的Volume,再将剩下的Volume与光源计算相交性。
|
||||
*/
|
||||
Cluster, ///<集簇剔除
|
||||
|
||||
ENUM_CLASS_RANGE(None,Cluster)
|
||||
};//enum class LightingCullingMode
|
||||
|
||||
enum class RenderingMode
|
||||
{
|
||||
Forward, ///<前向渲染
|
||||
|
||||
Deferred, ///<延迟渲染
|
||||
|
||||
ENUM_CLASS_RANGE(Forward,Deferred)
|
||||
};//enum class RenderingMode
|
||||
|
||||
|
||||
enum class RenderPhase
|
||||
{
|
||||
PreRender, ///<渲染前
|
||||
|
||||
Physics, ///<物理
|
||||
Anim, ///<动画前
|
||||
|
||||
Depth, ///<渲染深度(一般用于Early-Z pass)
|
||||
|
||||
GBuffer, ///<生成GBuffer
|
||||
|
||||
Transparent, ///<渲染透明物件
|
||||
|
||||
PostProcess, ///<后处理
|
||||
|
||||
Submit, ///<提交指令队列
|
||||
Present, ///<呈现
|
||||
|
||||
ENUM_CLASS_RANGE(PreRender,Present)
|
||||
};//enum class RenderPhase
|
||||
|
||||
/**
|
||||
* 渲染框架
|
||||
*/
|
||||
class RenderFramework
|
||||
{
|
||||
ObjectList<RenderModule> module_list;
|
||||
|
||||
protected:
|
||||
|
||||
ViewportInfo viewport_info;
|
||||
|
||||
int swap_chain_count =0;
|
||||
|
||||
protected:
|
||||
|
||||
GPUDevice * device =nullptr;
|
||||
RenderPass * device_render_pass =nullptr;
|
||||
RTSwapchain * default_rt =nullptr;
|
||||
|
||||
RenderCmdBuffer ** render_cmd_buffers =nullptr;
|
||||
|
||||
private:
|
||||
|
||||
uint64 frame_count =0;
|
||||
|
||||
public:
|
||||
|
||||
const uint64 GetFrameCount ()const noexcept{return frame_count;} ///<取得当前帧数
|
||||
void RestartFrameCount ()noexcept{frame_count=0;} ///<重新开始统计帧数
|
||||
|
||||
public:
|
||||
|
||||
NO_COPY_NO_MOVE(RenderFramework)
|
||||
|
||||
RenderFramework(){}
|
||||
virtual ~RenderFramework()=default;
|
||||
|
||||
/**
|
||||
* @pragma delta_time 本帧时间间隔
|
||||
*/
|
||||
virtual void Update(const double delta_time){}
|
||||
|
||||
virtual void BeginFrame(){}; ///<开始当前帧
|
||||
virtual void EndFrame(){}; ///<当前帧结束
|
||||
|
||||
virtual void MainLoop(); ///<主循环
|
||||
};//class RenderFramework
|
||||
|
||||
VK_NAMESPACE_END
|
66
inc/hgl/graph/RenderModule.h
Normal file
66
inc/hgl/graph/RenderModule.h
Normal file
@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
#include<hgl/type/Size2.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class RenderCmdBuffer;
|
||||
|
||||
/**
|
||||
* 渲染模块基类
|
||||
*/
|
||||
class RenderModule
|
||||
{
|
||||
OSString module_name;
|
||||
|
||||
VkExtent2D current_extent;
|
||||
|
||||
bool module_enable;
|
||||
bool module_ready;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void SetModuleEnable(bool e){module_enable=e;}
|
||||
virtual void SetModuleReady(bool r){module_ready=r;}
|
||||
|
||||
public:
|
||||
|
||||
const OSString &GetModuleName()const{return module_name;}
|
||||
|
||||
const bool IsEnable ()const noexcept{return module_enable;}
|
||||
const bool IsReady ()const noexcept{return module_ready;}
|
||||
|
||||
public:
|
||||
|
||||
NO_COPY_NO_MOVE(RenderModule)
|
||||
|
||||
RenderModule(const OSString &name)
|
||||
{
|
||||
module_name=name;
|
||||
}
|
||||
|
||||
virtual ~RenderModule()=default;
|
||||
|
||||
virtual bool Init(){return true;}
|
||||
|
||||
virtual void Execute(const double,RenderCmdBuffer *){}
|
||||
|
||||
virtual void OnResize(const VkExtent2D &ext){current_extent=ext;}
|
||||
virtual void OnFocusLost(){}
|
||||
|
||||
virtual void OnPreFrame(){}
|
||||
virtual void OnPostFrame(){}
|
||||
};//class RenderModule
|
||||
|
||||
template<typename T> RenderModule *Create()
|
||||
{
|
||||
return new T();
|
||||
}
|
||||
|
||||
typedef RenderModule *(*RenderModuleCreateFunc)();
|
||||
|
||||
bool RegistryRenderModule(const OSString &,RenderModuleCreateFunc);
|
||||
RenderModule *GetRenderModule(const OSString &);
|
||||
|
||||
VK_NAMESPACE_END
|
39
inc/hgl/graph/component/Component.h
Normal file
39
inc/hgl/graph/component/Component.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/type/TypeInfo.h>
|
||||
#include<hgl/graph/VK.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class SceneNode;
|
||||
|
||||
class SceneComponentData
|
||||
{
|
||||
};//class SceneComponentData
|
||||
|
||||
class SceneComponentManager;
|
||||
|
||||
class SceneComponent
|
||||
{
|
||||
SceneComponentManager *manager;
|
||||
|
||||
SceneNode *owner;
|
||||
|
||||
public:
|
||||
|
||||
SceneComponentManager *GetManager()const{return manager;}
|
||||
|
||||
SceneNode *GetOwner()const{return owner;}
|
||||
|
||||
virtual const size_t GetTypeHash()=0;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
};//class SceneComponent
|
||||
|
||||
class SceneComponentManager
|
||||
{
|
||||
};//class SceneComponentManager
|
||||
|
||||
VK_NAMESPACE_END
|
39
inc/hgl/graph/component/SceneComponent.h
Normal file
39
inc/hgl/graph/component/SceneComponent.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/type/TypeInfo.h>
|
||||
#include<hgl/graph/VK.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class SceneNode;
|
||||
|
||||
class ComponentData
|
||||
{
|
||||
};//class ComponentData
|
||||
|
||||
class ComponentManager;
|
||||
|
||||
class Component
|
||||
{
|
||||
ComponentManager *manager;
|
||||
|
||||
SceneNode *owner;
|
||||
|
||||
public:
|
||||
|
||||
ComponentManager *GetManager()const{return manager;}
|
||||
|
||||
SceneNode *GetOwner()const{return owner;}
|
||||
|
||||
virtual const size_t GetTypeHash()=0;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
};//class Component
|
||||
|
||||
class ComponentManager
|
||||
{
|
||||
};//class ComponentManager
|
||||
|
||||
VK_NAMESPACE_END
|
63
inc/hgl/graph/deferred/GBufferFormat.h
Normal file
63
inc/hgl/graph/deferred/GBufferFormat.h
Normal file
@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VK.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
/**
|
||||
/
|
||||
|
||||
|
||||
//Material models from Google Filament
|
||||
//@see https://google.github.io/filament/Materials.html
|
||||
|
||||
enum class MaterialModels:uint8
|
||||
{
|
||||
Unlit=0,
|
||||
Lit,
|
||||
Subsurface,
|
||||
Cloth,
|
||||
};
|
||||
|
||||
struct GBufferFormat
|
||||
{
|
||||
VkFormat ShadingModel; ///<着色模式
|
||||
|
||||
VkFormat BaseColor; ///<颜色缓冲区格式
|
||||
VkFormat Depth; ///<深度缓冲区格式
|
||||
VkFormat Stencil; ///<模板缓冲区格式
|
||||
|
||||
VkFormat Normal; ///<法线缓冲区格式
|
||||
|
||||
VkFormat Metallic; ///<金属度
|
||||
VkFormat Roughness; ///<粗糙度(glossiness)
|
||||
VkFormat Reflectance; ///<反射率(Specular for non-metals)
|
||||
|
||||
VkFormat ClearCoat;
|
||||
VkFormat ClearCoatRoughness;
|
||||
VkFormat Anisotropy;
|
||||
|
||||
VkFormat Emissive; ///<自发光
|
||||
VkFormat AmbientOcclusion; ///<环境光遮蔽
|
||||
|
||||
VkFormat MotionVector; ///<运动向量
|
||||
};//struct GBufferFormat
|
||||
|
||||
void InitGBufferFormat(GBufferFormat &bf)
|
||||
{
|
||||
bf.BaseColor =PF_A2BGR10UN;
|
||||
|
||||
bf.Depth =PF_D24UN_S8U;
|
||||
bf.Stencil =PF_D24UN_S8U;
|
||||
|
||||
bf.Normal =PF_RG8UN;
|
||||
|
||||
bf.MetallicRoughness=PF_RG8UN;
|
||||
|
||||
bf.Emissive =PF_A2BGR10UN;
|
||||
bf.AmbientOcclusion =PF_R8UN;
|
||||
|
||||
bf.MotionVector =PF_RG16SN;
|
||||
}
|
||||
|
||||
VK_NAMESPACE_END
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/VKNamespace.h>
|
||||
#include<hgl/graph/StaticMeshLODPolicy.h>
|
||||
#include<hgl/graph/mesh/StaticMeshLODPolicy.h>
|
||||
#include<hgl/graph/ShadowPolicy.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
17
inc/hgl/graph/mesh/StaticMeshNode.h
Normal file
17
inc/hgl/graph/mesh/StaticMeshNode.h
Normal file
@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include<hgl/graph/SceneNode.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
class StaticMeshNode:public SceneNode
|
||||
{
|
||||
StaticMesh *sm;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
};//class StaticMeshNode
|
||||
|
||||
VK_NAMESPACE_END
|
@ -5,56 +5,6 @@
|
||||
#include<hgl/graph/VertexAttrib.h>
|
||||
|
||||
STD_MTL_NAMESPACE_BEGIN
|
||||
enum class LightingModel:uint8
|
||||
{
|
||||
Unlit,
|
||||
|
||||
Gizmo, ///<Gizmo专用(Blinnphong的特定版本,内置假的太阳光方向、高光系数等,使其不需要外部UBO传入)
|
||||
|
||||
Blinnphong, ///<Blinnphong光照模型
|
||||
|
||||
FakePBR, ///<假PBR(使用Blinnphong+HalfLambert模拟)
|
||||
MicroPBR, ///<微型PBR(只有BaseColor/Normal/Metallic/Roughness四个基础数据的PBR)
|
||||
|
||||
WebPBR, ///<Khronos为WebGL提供的PBR
|
||||
FilamentPBR, ///<Filament引擎所使用的PBR
|
||||
AMDPBR, ///<AMD Caulrdon框架所使用的PBR
|
||||
|
||||
BlenderPBR, ///<Blender所使用的PBR
|
||||
|
||||
ENUM_CLASS_RANGE(Unlit,BlenderPBR)
|
||||
};
|
||||
|
||||
constexpr const char *LightingModelName[]=
|
||||
{
|
||||
"Unlit",
|
||||
|
||||
"Gizmo",
|
||||
|
||||
"Blinnphong",
|
||||
|
||||
"FakePBR",
|
||||
"MicroPBR",
|
||||
|
||||
"WebPBR",
|
||||
"FilamentPBR",
|
||||
"AMDPBR",
|
||||
|
||||
"BlenderPBR"
|
||||
};
|
||||
|
||||
/**
|
||||
* 天光来源
|
||||
*/
|
||||
enum class SkyLightSource:uint8
|
||||
{
|
||||
PureColor, ///<纯色
|
||||
Simplest, ///<极简(一行代码)
|
||||
Cubemap, ///<立方体贴图
|
||||
IBL, ///<IBL立方体贴图
|
||||
|
||||
ENUM_CLASS_RANGE(PureColor,IBL)
|
||||
};
|
||||
|
||||
struct Material3DCreateConfig:public MaterialCreateConfig
|
||||
{
|
||||
|
@ -64,12 +64,21 @@ SET(SCENE_GRAPH_SOURCE RenderList.cpp
|
||||
|
||||
SOURCE_GROUP("Scene Graph" FILES ${SCENE_GRAPH_HEADER} ${SCENE_GRAPH_SOURCE})
|
||||
|
||||
SET(STATIC_MESH_HEADER_FILES ${SG_INCLUDE_PATH}/StaticMesh.h
|
||||
${SG_INCLUDE_PATH}/StaticMeshLODPolicy.h)
|
||||
SET(SGC_HEADER_PATH ${SG_INCLUDE_PATH}/component)
|
||||
SET(SGC_SOURCE_PATH component)
|
||||
|
||||
SET(STATIC_MESH_SOURCE_FILES StaticMesh.cpp)
|
||||
SET(SG_COMPONENT_HEADER ${SGC_HEADER_PATH}/SceneComponent.h)
|
||||
|
||||
SOURCE_GROUP("Scene Graph\\Static Mesh" FILES ${STATIC_MESH_HEADER_FILES} ${STATIC_MESH_SOURCE_FILES})
|
||||
SOURCE_GROUP("Scene Graph\\Component" FILES ${SG_COMPONENT_HEADER})
|
||||
|
||||
SET(STATIC_MESH_HEADER_FILES ${SG_INCLUDE_PATH}/mesh/StaticMesh.h
|
||||
${SG_INCLUDE_PATH}/mesh/StaticMeshLODPolicy.h
|
||||
${SG_INCLUDE_PATH}/mesh/StaticMeshNode.h
|
||||
)
|
||||
|
||||
SET(STATIC_MESH_SOURCE_FILES mesh/StaticMesh.cpp)
|
||||
|
||||
SOURCE_GROUP("Scene Graph\\Mesh\\Static Mesh" FILES ${STATIC_MESH_HEADER_FILES} ${STATIC_MESH_SOURCE_FILES})
|
||||
|
||||
SET(FONT_MANAGE_SOURCE ${SG_INCLUDE_PATH}/font/Font.h
|
||||
${SG_INCLUDE_PATH}/font/FontManage.h
|
||||
@ -259,6 +268,21 @@ SET(VK_RENDERABLE_SOURCE ${SG_INCLUDE_PATH}/VKRenderable.h
|
||||
|
||||
SOURCE_GROUP("Vulkan\\Renderable" FILES ${VK_RENDERABLE_SOURCE})
|
||||
|
||||
SET(RENDER_MODULE_HEADER ${SG_INCLUDE_PATH}/RenderModule.h)
|
||||
SET(RENDER_MODULE_SOURCE RenderModule/RenderModule.cpp)
|
||||
|
||||
SET(RENDER_FRAMEWORK_FILES ${SG_INCLUDE_PATH}/RenderFramework.h
|
||||
RenderFramework.cpp)
|
||||
|
||||
SOURCE_GROUP("RenderModule" FILES ${RENDER_MODULE_HEADER}
|
||||
${RENDER_MODULE_SOURCE}
|
||||
${RENDER_FRAMEWORK_FILES})
|
||||
|
||||
SET(DEFERRED_RENDER_HEADER ${SG_INCLUDE_PATH}/deferred/GBufferFormat.h)
|
||||
SET(DEFERRED_RENDER_SOURCE deferred/GBufferFormat.cpp)
|
||||
|
||||
SOURCE_GROUP("RenderModule\\Deferred Rendering" FILES ${DEFERRED_RENDER_HEADER} ${DEFERRED_RENDER_SOURCE})
|
||||
|
||||
IF(WIN32)
|
||||
OPTION(FORCE_DISCETE_GPU "Force Discrete GPU" OFF)
|
||||
|
||||
@ -319,6 +343,8 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER}
|
||||
${TILE_SOURCE}
|
||||
${SG_VDM_SOURCE}
|
||||
|
||||
${SG_COMPONENT_HEADER}
|
||||
|
||||
${STATIC_MESH_HEADER_FILES}
|
||||
${STATIC_MESH_SOURCE_FILES}
|
||||
|
||||
@ -330,4 +356,8 @@ add_cm_library(ULRE.SceneGraph "ULRE" ${SCENE_GRAPH_HEADER}
|
||||
# ${TEXT_RENDERABLE_SOURCE}
|
||||
|
||||
${VULKAN_RENDER_SOURCE}
|
||||
${VULKAN_SURFACE_SOURCE})
|
||||
${VULKAN_SURFACE_SOURCE}
|
||||
|
||||
${RENDER_MODULE_HEADER} ${RENDER_MODULE_SOURCE} ${RENDER_FRAMEWORK_FILES}
|
||||
${DEFERRED_RENDER_HEADER} ${DEFERRED_RENDER_SOURCE}
|
||||
)
|
||||
|
@ -248,6 +248,7 @@ void MaterialRenderList::WriteICB(VkDrawIndirectCommand *dicp,RenderItem *ri)
|
||||
dicp->firstVertex =ri->prd->vertex_offset;
|
||||
dicp->firstInstance =ri->first_instance;
|
||||
}
|
||||
|
||||
void MaterialRenderList::WriteICB(VkDrawIndexedIndirectCommand *diicp,RenderItem *ri)
|
||||
{
|
||||
diicp->indexCount =ri->prd->index_count;
|
||||
@ -432,7 +433,7 @@ void MaterialRenderList::Render(RenderItem *ri)
|
||||
BindVAB(ri->pdb,ri->first_instance);
|
||||
|
||||
if(ri->pdb->ibo)
|
||||
cmd_buf->BindIBO(ri->pdb->ibo);
|
||||
cmd_buf->BindIBO(ri->pdb->ibo);
|
||||
}
|
||||
|
||||
if(ri->pdb->vdm)
|
||||
|
31
src/SceneGraph/RenderFramework.cpp
Normal file
31
src/SceneGraph/RenderFramework.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include<hgl/graph/RenderFramework.h>
|
||||
#include<hgl/graph/RenderModule.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
void RenderFramework::MainLoop()
|
||||
{
|
||||
for(auto rm:module_list)
|
||||
{
|
||||
if(rm->IsEnable())
|
||||
rm->OnPreFrame();
|
||||
}
|
||||
|
||||
BeginFrame();
|
||||
|
||||
for(auto rm:module_list)
|
||||
{
|
||||
if(rm->IsEnable())
|
||||
rm->Execute(0,nullptr);
|
||||
}
|
||||
|
||||
for(auto rm:module_list)
|
||||
{
|
||||
if(rm->IsEnable())
|
||||
rm->OnPostFrame();
|
||||
}
|
||||
|
||||
EndFrame();
|
||||
}
|
||||
|
||||
VK_NAMESPACE_END
|
39
src/SceneGraph/RenderModule/RenderModule.cpp
Normal file
39
src/SceneGraph/RenderModule/RenderModule.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include<hgl/graph/RenderModule.h>
|
||||
#include<hgl/type/Map.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
||||
|
||||
namespace
|
||||
{
|
||||
using RenderModuleMap=Map<OSString,RenderModuleCreateFunc>;
|
||||
|
||||
RenderModuleMap render_module_map;
|
||||
}//namespace
|
||||
|
||||
bool RegistryRenderModule(const OSString &name,RenderModuleCreateFunc func)
|
||||
{
|
||||
if(name.IsEmpty()||!func)
|
||||
return(false);
|
||||
|
||||
if(render_module_map.ContainsKey(name))
|
||||
return(false);
|
||||
|
||||
render_module_map.Add(name,func);
|
||||
|
||||
return(true);
|
||||
}
|
||||
|
||||
RenderModule *GetRenderModule(const OSString &name)
|
||||
{
|
||||
if(name.IsEmpty())
|
||||
return(nullptr);
|
||||
|
||||
RenderModuleCreateFunc func;
|
||||
|
||||
if(!render_module_map.Get(name,func))
|
||||
return(nullptr);
|
||||
|
||||
return func();
|
||||
}
|
||||
|
||||
VK_NAMESPACE_END
|
0
src/SceneGraph/deferred/GBufferFormat.cpp
Normal file
0
src/SceneGraph/deferred/GBufferFormat.cpp
Normal file
@ -1,4 +1,4 @@
|
||||
#include<hgl/graph/StaticMesh.h>
|
||||
#include<hgl/graph/mesh/StaticMesh.h>
|
||||
#include<hgl/graph/VKRenderResource.h>
|
||||
|
||||
VK_NAMESPACE_BEGIN
|
Loading…
x
Reference in New Issue
Block a user