迁移CreatePipeline/CreateMaterialInstance/GetPrimitiveCreater到RenderFramework
This commit is contained in:
parent
d384f06ee2
commit
dfa0b4033d
@ -78,57 +78,15 @@ namespace hgl
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template<typename ...ARGS>
|
#define WO_FUNC_FROM_RENDER_FRAMEWORK(name,return_type) template<typename ...ARGS> return_type name(ARGS...args){return render_framework?render_framework->name(args...):nullptr;}
|
||||||
graph::Pipeline *CreatePipeline(ARGS...args)
|
|
||||||
{
|
|
||||||
return renderer->GetRenderPass()->CreatePipeline(args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
graph::MaterialInstance *CreateMaterialInstance(const AnsiString &mi_name,const graph::mtl::MaterialCreateInfo *mci,const graph::VILConfig *vil_cfg=nullptr)
|
WO_FUNC_FROM_RENDER_FRAMEWORK(CreatePipeline,graph::Pipeline *)
|
||||||
{
|
WO_FUNC_FROM_RENDER_FRAMEWORK(CreateMaterialInstance,graph::MaterialInstance *)
|
||||||
return db->CreateMaterialInstance(mi_name,mci,vil_cfg);
|
WO_FUNC_FROM_RENDER_FRAMEWORK(GetPrimitiveCreater,SharedPtr<graph::PrimitiveCreater>)
|
||||||
}
|
WO_FUNC_FROM_RENDER_FRAMEWORK(CreatePrimitive,graph::Primitive *)
|
||||||
|
WO_FUNC_FROM_RENDER_FRAMEWORK(CreateMesh,graph::Mesh *)
|
||||||
graph::MaterialInstance *CreateMaterialInstance(const AnsiString &mtl_name,graph::mtl::MaterialCreateConfig *mtl_cfg,const graph::VILConfig *vil_cfg=nullptr)
|
|
||||||
{
|
|
||||||
AutoDelete<graph::mtl::MaterialCreateInfo> mci=graph::mtl::CreateMaterialCreateInfo(GetDevAttr(),mtl_name,mtl_cfg);
|
|
||||||
|
|
||||||
return db->CreateMaterialInstance(mtl_name,mci,vil_cfg);
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoDelete<graph::PrimitiveCreater> GetPrimitiveCreater(graph::Material *mtl)
|
|
||||||
{
|
|
||||||
if(!mtl)
|
|
||||||
return(nullptr);
|
|
||||||
|
|
||||||
return(new graph::PrimitiveCreater(GetDevice(),mtl->GetDefaultVIL()));
|
|
||||||
}
|
|
||||||
|
|
||||||
AutoDelete<graph::PrimitiveCreater> GetPrimitiveCreater(graph::MaterialInstance *mi)
|
|
||||||
{
|
|
||||||
if(!mi)
|
|
||||||
return(nullptr);
|
|
||||||
|
|
||||||
return(new graph::PrimitiveCreater(GetDevice(),mi->GetVIL()));
|
|
||||||
}
|
|
||||||
|
|
||||||
graph::Primitive *CreatePrimitive( const AnsiString &name,
|
|
||||||
const uint32_t vertices_count,
|
|
||||||
const graph::VIL *vil,
|
|
||||||
const std::initializer_list<graph::VertexAttribDataPtr> &vad_list)
|
|
||||||
{
|
|
||||||
return render_framework?render_framework->CreatePrimitive(name,vertices_count,vil,vad_list):nullptr; //创建Primitive
|
|
||||||
}
|
|
||||||
|
|
||||||
graph::Mesh *CreateMesh(const AnsiString &name,
|
|
||||||
const uint32_t vertices_count,
|
|
||||||
graph::MaterialInstance *mi,
|
|
||||||
graph::Pipeline *pipeline,
|
|
||||||
const std::initializer_list<graph::VertexAttribDataPtr> &vad_list)
|
|
||||||
{
|
|
||||||
return render_framework?render_framework->CreateMesh(name,vertices_count,mi,pipeline,vad_list):nullptr; //创建Mesh
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#undef WO_FUNC_FROM_RENDER_FRAMEWORK
|
||||||
public: //Component 相关
|
public: //Component 相关
|
||||||
|
|
||||||
template<typename C,typename ...ARGS>
|
template<typename C,typename ...ARGS>
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
#include<hgl/graph/module/GraphModuleManager.h>
|
#include<hgl/graph/module/GraphModuleManager.h>
|
||||||
#include<hgl/graph/RenderList.h>
|
#include<hgl/graph/RenderList.h>
|
||||||
#include<hgl/graph/CameraControl.h>
|
#include<hgl/graph/CameraControl.h>
|
||||||
|
#include<hgl/graph/Renderer.h>
|
||||||
|
#include<hgl/graph/VKRenderResource.h>
|
||||||
|
#include<hgl/graph/mtl/MaterialLibrary.h>
|
||||||
#include<hgl/io/event/MouseEvent.h>
|
#include<hgl/io/event/MouseEvent.h>
|
||||||
|
|
||||||
VK_NAMESPACE_BEGIN
|
VK_NAMESPACE_BEGIN
|
||||||
@ -93,6 +96,8 @@ public:
|
|||||||
CameraControl * GetDefaultCameraControl (){return default_camera_control;}
|
CameraControl * GetDefaultCameraControl (){return default_camera_control;}
|
||||||
Renderer * GetDefaultRenderer (){return default_renderer;}
|
Renderer * GetDefaultRenderer (){return default_renderer;}
|
||||||
|
|
||||||
|
RenderPass * GetDefaultRenderPass (){return default_renderer->GetRenderPass();}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool GetMouseCoord(Vector2i *mc)const
|
bool GetMouseCoord(Vector2i *mc)const
|
||||||
@ -130,6 +135,42 @@ public: // other
|
|||||||
|
|
||||||
TileFont *CreateTileFont(FontSource *fs,int limit_count=-1); ///<创建只使用一种字符的Tile字符管理对象
|
TileFont *CreateTileFont(FontSource *fs,int limit_count=-1); ///<创建只使用一种字符的Tile字符管理对象
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
template<typename ...ARGS>
|
||||||
|
graph::Pipeline *CreatePipeline(ARGS...args)
|
||||||
|
{
|
||||||
|
return GetDefaultRenderPass()->CreatePipeline(args...);
|
||||||
|
}
|
||||||
|
|
||||||
|
graph::MaterialInstance *CreateMaterialInstance(const AnsiString &mi_name,const graph::mtl::MaterialCreateInfo *mci,const graph::VILConfig *vil_cfg=nullptr)
|
||||||
|
{
|
||||||
|
return render_resource->CreateMaterialInstance(mi_name,mci,vil_cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
graph::MaterialInstance *CreateMaterialInstance(const AnsiString &mtl_name,graph::mtl::MaterialCreateConfig *mtl_cfg,const graph::VILConfig *vil_cfg=nullptr)
|
||||||
|
{
|
||||||
|
AutoDelete<graph::mtl::MaterialCreateInfo> mci=graph::mtl::CreateMaterialCreateInfo(GetDevAttr(),mtl_name,mtl_cfg);
|
||||||
|
|
||||||
|
return render_resource->CreateMaterialInstance(mtl_name,mci,vil_cfg);
|
||||||
|
}
|
||||||
|
|
||||||
|
SharedPtr<graph::PrimitiveCreater> GetPrimitiveCreater(graph::Material *mtl)
|
||||||
|
{
|
||||||
|
if(!mtl)
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
return(new graph::PrimitiveCreater(GetDevice(),mtl->GetDefaultVIL()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SharedPtr<graph::PrimitiveCreater> GetPrimitiveCreater(graph::MaterialInstance *mi)
|
||||||
|
{
|
||||||
|
if(!mi)
|
||||||
|
return(nullptr);
|
||||||
|
|
||||||
|
return(new graph::PrimitiveCreater(GetDevice(),mi->GetVIL()));
|
||||||
|
}
|
||||||
|
|
||||||
public: // Primitive, Mesh
|
public: // Primitive, Mesh
|
||||||
|
|
||||||
graph::Primitive *CreatePrimitive(const AnsiString &name,
|
graph::Primitive *CreatePrimitive(const AnsiString &name,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user