将WorkObject增加bool Init()=0纯虚函数用于负责初始化。
这一分支结束,下一分支基于03_auto_instance范例开发WorldManager用于全局World管理,直接由World提供RenderList/SceneRoot等。
This commit is contained in:
@@ -80,7 +80,15 @@ namespace hgl
|
||||
|
||||
SwapchainWorkManager wm(&rf);
|
||||
|
||||
wm.Run(new WO(&rf));
|
||||
WO *wo=new WO(&rf);
|
||||
|
||||
if(!wo->Init())
|
||||
{
|
||||
delete wo;
|
||||
return(-2);
|
||||
}
|
||||
|
||||
wm.Run(wo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ namespace hgl
|
||||
graph::RenderFramework * GetRenderFramework (){return render_framework;}
|
||||
graph::VulkanDevice * GetDevice (){return render_framework->GetDevice();}
|
||||
graph::VulkanDevAttr * GetDevAttr (){return render_framework->GetDevAttr();}
|
||||
graph::TextureManager * GetTextureManager (){return render_framework->GetTextureManager();}
|
||||
|
||||
const VkExtent2D & GetExtent2D (){return cur_render_target->GetExtent();}
|
||||
|
||||
@@ -53,9 +54,11 @@ namespace hgl
|
||||
|
||||
public:
|
||||
|
||||
WorkObject(graph::RenderFramework *,graph::IRenderTarget *);
|
||||
WorkObject(graph::RenderFramework *,graph::IRenderTarget *rt=nullptr);
|
||||
virtual ~WorkObject()=default;
|
||||
|
||||
virtual bool Init()=0;
|
||||
|
||||
virtual void OnRenderTargetSwitch(graph::RenderFramework *rf,graph::IRenderTarget *rt);
|
||||
|
||||
virtual void OnResize(const VkExtent2D &){}
|
||||
|
@@ -33,7 +33,7 @@ public:
|
||||
const AnsiString & GetName ()const{ return prim_name; }
|
||||
|
||||
const VkDeviceSize GetVertexCount ()const;
|
||||
const int GetVABCount ()const;
|
||||
const uint32_t GetVABCount ()const;
|
||||
const int GetVABIndex (const AnsiString &name)const;
|
||||
VAB * GetVAB (const int);
|
||||
VAB * GetVAB (const AnsiString &name){return GetVAB(GetVABIndex(name));}
|
||||
|
@@ -127,9 +127,9 @@ public: //Material
|
||||
|
||||
const ShaderModule *CreateShaderModule(const AnsiString &shader_module_name,const ShaderCreateInfo *);
|
||||
|
||||
Material * CreateMaterial(const AnsiString &mtl_name,const mtl::MaterialCreateInfo *);
|
||||
Material * LoadMaterial(const AnsiString &,mtl::Material2DCreateConfig *);
|
||||
Material * LoadMaterial(const AnsiString &,mtl::Material3DCreateConfig *);
|
||||
Material * CreateMaterial (const AnsiString &,const mtl::MaterialCreateInfo *);
|
||||
Material * LoadMaterial (const AnsiString &,mtl::Material2DCreateConfig *);
|
||||
Material * LoadMaterial (const AnsiString &,mtl::Material3DCreateConfig *);
|
||||
|
||||
MaterialInstance * CreateMaterialInstance(Material *,const VILConfig *vil_cfg=nullptr);
|
||||
|
||||
@@ -143,31 +143,31 @@ public: //Material
|
||||
|
||||
MaterialInstance * CreateMaterialInstance(const AnsiString &mtl_name,const mtl::MaterialCreateInfo *,const VILConfig *vil_cfg=nullptr);
|
||||
|
||||
Mesh * CreateMesh(Primitive *r,MaterialInstance *mi,Pipeline *p);
|
||||
Mesh * CreateMesh(PrimitiveCreater *pc,MaterialInstance *mi,Pipeline *p);
|
||||
Mesh * CreateMesh(Primitive *r,MaterialInstance *mi,Pipeline *p);
|
||||
Mesh * CreateMesh(PrimitiveCreater *pc,MaterialInstance *mi,Pipeline *p);
|
||||
|
||||
Sampler * CreateSampler(VkSamplerCreateInfo *sci=nullptr);
|
||||
Sampler * CreateSampler(Texture *);
|
||||
|
||||
public: //Get
|
||||
|
||||
Material * GetMaterial (const MaterialID &id){return rm_material.Get(id);}
|
||||
MaterialInstance * GetMaterialInstance (const MaterialInstanceID &id){return rm_material_instance.Get(id);}
|
||||
DescriptorSet * GetDescSets (const DescriptorSetID &id){return rm_desc_sets.Get(id);}
|
||||
Primitive * GetPrimitive (const PrimitiveID &id){return rm_primitives.Get(id);}
|
||||
DeviceBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);}
|
||||
Sampler * GetSampler (const SamplerID &id){return rm_samplers.Get(id);}
|
||||
Mesh * GetRenderable (const RenderableID &id){return rm_renderables.Get(id);}
|
||||
Material * GetMaterial (const MaterialID &id){return rm_material.Get(id);}
|
||||
MaterialInstance * GetMaterialInstance (const MaterialInstanceID &id){return rm_material_instance.Get(id);}
|
||||
DescriptorSet * GetDescSets (const DescriptorSetID &id){return rm_desc_sets.Get(id);}
|
||||
Primitive * GetPrimitive (const PrimitiveID &id){return rm_primitives.Get(id);}
|
||||
DeviceBuffer * GetBuffer (const BufferID &id){return rm_buffers.Get(id);}
|
||||
Sampler * GetSampler (const SamplerID &id){return rm_samplers.Get(id);}
|
||||
Mesh * GetRenderable (const RenderableID &id){return rm_renderables.Get(id);}
|
||||
|
||||
public: //Release
|
||||
|
||||
void Release(Material * mtl ){rm_material.Release(mtl);}
|
||||
void Release(MaterialInstance * mi ){rm_material_instance.Release(mi);}
|
||||
void Release(DescriptorSet * ds ){rm_desc_sets.Release(ds);}
|
||||
void Release(Primitive * p ){rm_primitives.Release(p);}
|
||||
void Release(DeviceBuffer * buf ){rm_buffers.Release(buf);}
|
||||
void Release(Sampler * s ){rm_samplers.Release(s);}
|
||||
void Release(Mesh * r ){rm_renderables.Release(r);}
|
||||
void Release(Material * mtl ){rm_material.Release(mtl);}
|
||||
void Release(MaterialInstance * mi ){rm_material_instance.Release(mi);}
|
||||
void Release(DescriptorSet * ds ){rm_desc_sets.Release(ds);}
|
||||
void Release(Primitive * p ){rm_primitives.Release(p);}
|
||||
void Release(DeviceBuffer * buf ){rm_buffers.Release(buf);}
|
||||
void Release(Sampler * s ){rm_samplers.Release(s);}
|
||||
void Release(Mesh * r ){rm_renderables.Release(r);}
|
||||
};//class RenderResource
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user