ULRE/inc/hgl/graph/RenderFramework.h

118 lines
2.8 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include<hgl/graph/BlendMode.h>
#include<hgl/type/List.h>
#include<hgl/graph/ViewportInfo.h>
VK_NAMESPACE_BEGIN
enum class RenderOrder
{
First, ///<最先渲染
NearToFar, ///<从近到远
Irrorder, ///<无序渲染
FarToNear, ///<从远到近
Last, ///<最后渲染
ENUM_CLASS_RANGE(First,Last)
};//enum class RenderOrder
class GraphModule;
/**
* 渲染模块工作配置
*/
class GraphModuleWorkConfig
{
/**
* 渲染模块名称
* 在render_module为nullptr时用于创建或加载RenderModule。
* 它和RenderModule返回的名称有可能一样但也有可能不一样。
*/
AnsiString render_module_name;
GraphModule *render_module=nullptr;
BlendMode blend_mode;
RenderOrder render_order;
public:
const AnsiString &GetModuleName()const{return render_module_name;} ///<取得渲染模块名称
GraphModule *GetModule(){return render_module;} ///<取得渲染模块
public:
GraphModuleWorkConfig();
virtual ~GraphModuleWorkConfig()=default;
};//class GraphModuleWorkConfig
class Window;
class TextureManager;
class SwapchainModule;
/**
* 渲染框架
*/
class RenderFramework
{
protected:
Window * win =nullptr;
VulkanInstance * inst =nullptr;
GPUDevice * device =nullptr;
protected:
GraphModuleManager *graph_module_manager=nullptr;
ObjectList<GraphModule> module_list;
TextureManager * texture_manager =nullptr;
SwapchainModule * swapchain_module =nullptr;
protected:
ViewportInfo viewport_info;
private:
double last_time =0;
double cur_time =0;
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;
virtual void StartTime();
/**
* @pragma delta_time 本帧时间间隔
*/
virtual void Update(const double delta_time){}
virtual void BeginFrame(){}; ///<开始当前帧
virtual void EndFrame(){}; ///<当前帧结束
virtual void MainLoop(); ///<主循环
};//class RenderFramework
VK_NAMESPACE_END