ULRE/inc/hgl/graph/VKRenderablePrimitiveCreater.h

53 lines
1.2 KiB
C
Raw Normal View History

#ifndef HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE
#define HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE
#include<hgl/graph/VKRenderResource.h>
VK_NAMESPACE_BEGIN
class RenderablePrimitiveCreater
{
RenderResource *rr;
uint32_t vertex_count;
Primitive *prim;
public:
2023-10-12 05:55:39 +08:00
RenderablePrimitiveCreater(RenderResource *_rr,const AnsiString &name,uint32_t vc)
{
rr=_rr;
vertex_count=vc;
2023-10-12 05:55:39 +08:00
prim=rr->CreatePrimitive(name,vertex_count);
}
2024-04-24 01:44:01 +08:00
VAB *SetVAB(const AnsiString &name,const VkFormat &fmt,const void *buf)
{
2024-04-24 01:44:01 +08:00
VAB *vab=rr->CreateVAB(fmt,vertex_count,buf);
2024-04-24 01:38:55 +08:00
if(!vab)
2023-10-05 00:48:00 +08:00
return(nullptr);
2024-04-24 01:38:55 +08:00
prim->Set(name,vab);
return(vab);
}
2023-10-05 00:48:00 +08:00
IndexBuffer *SetIBO(const IndexType &it,const void *buf,const uint32_t index_count)
{
IndexBuffer *ibo=rr->CreateIBO(it,index_count,buf);
if(!ibo)
2023-10-05 00:48:00 +08:00
return(nullptr);
prim->Set(ibo);
2023-10-05 00:48:00 +08:00
return(ibo);
}
Renderable *Create(MaterialInstance *mi,Pipeline *p)
{
return rr->CreateRenderable(prim,mi,p);
}
};//class RenderablePrimitiveCreater
VK_NAMESPACE_END
#endif // HGL_VK_RENDERABLE_PRIMITIVE_CREATER_INCLUDE