ULRE/inc/hgl/graph/font/TextRender.h

80 lines
2.3 KiB
C
Raw Normal View History

2022-02-17 10:48:12 +08:00
#ifndef HGL_GRAPH_TEXT_RENDER_INCLUDE
2022-02-16 23:26:50 +08:00
#define HGL_GRAPH_TEXT_RENDER_INCLUDE
#include<hgl/graph/VK.h>
#include<hgl/type/Color4f.h>
namespace hgl
{
namespace graph
{
class FontSource;
class TileFont;
class TextLayout;
class TextRenderable;
class TextRender
{
GPUDevice * device =nullptr;
RenderResource * db =nullptr;
Material * material =nullptr;
MaterialInstance * material_instance =nullptr;
Sampler * sampler =nullptr;
Pipeline * pipeline =nullptr;
2022-02-17 10:48:12 +08:00
FontSource * font_source =nullptr;
2022-02-16 23:26:50 +08:00
TileFont * tile_font =nullptr;
TextLayout * tl_engine =nullptr;
Color4f color;
GPUBuffer * ubo_color =nullptr;
private:
2022-02-17 10:48:12 +08:00
friend TextRender *CreateTextRender(GPUDevice *,FontSource *,RenderPass *,GPUBuffer *);
TextRender(GPUDevice *dev,FontSource *);
2022-02-16 23:26:50 +08:00
bool InitTileFont();
bool InitTextLayoutEngine();
bool InitUBO();
bool InitMaterial(RenderPass *,GPUBuffer *);
public:
2022-02-17 10:48:12 +08:00
~TextRender();
2022-02-16 23:26:50 +08:00
bool Init(RenderPass *rp,GPUBuffer *ubo_camera_info);
2022-02-17 10:48:12 +08:00
public:
2022-02-16 23:26:50 +08:00
TextRenderable *CreateRenderable();
RenderableInstance *CreateRenderableInstance(TextRenderable *text_render_obj,const UTF16String &str);
};//class TextRender
2022-02-17 10:48:12 +08:00
/**
* CJK字体源
* @param cf CJK字体名称
* @param lf
* @param size
*/
FontSource *CreateCJKFontSource(const os_char *cf,const os_char *lf,const uint32_t size);
/**
*
* @param name
* @param size
*/
FontSource *CreateFontSource(const os_char *name,const uint32_t size);
/**
* .
*/
TextRender *CreateTextRender(GPUDevice *,FontSource *,RenderPass *,GPUBuffer *);
2022-02-16 23:26:50 +08:00
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_TEXT_RENDER_INCLUDE