Nebula
Loading...
Searching...
No Matches
vktextrenderer.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
9//------------------------------------------------------------------------------
11#include "coregraphics/shader.h"
15#include "stb_truetype.h"
16namespace Vulkan
17{
19{
22public:
23
30
34 virtual ~VkTextRenderer();
35
37 void Open();
39 void Close();
42
43 static const int MaxNumChars = 65535;
44private:
45
46
48 void Draw(const CoreGraphics::CmdBufferId cmdBuf, TextElementVertex* buffer, SizeT numChars);
49
51 Math::vec2 TransformTextVertex(const Math::vec2& pos, const Math::vec2& offset, const Math::vec2& scale);
52
53 // define tff buffer
54 stbtt_packedchar* cdata;
55 stbtt_fontinfo font;
56
58 CoreGraphics::ShaderProgramId program;
65 byte* vertexPtr;
66};
67} // namespace Vulkan
Base class for text rendering (don't use this for high-quality text rendering).
Definition textrendererbase.h:25
void DrawTextElements()
draw the accumulated text
Definition textrendererbase.cc:101
Defines a group of primitives as a subset of a vertex buffer and index buffer plus the primitive topo...
Definition primitivegroup.h:20
Definition vktextrenderer.h:19
stbtt_packedchar * cdata
Definition vktextrenderer.h:54
IndexT texVar
Definition vktextrenderer.h:59
CoreGraphics::VertexLayoutId layout
Definition vktextrenderer.h:64
static const int MaxNumChars
Definition vktextrenderer.h:43
Math::vec2 TransformTextVertex(const Math::vec2 &pos, const Math::vec2 &offset, const Math::vec2 &scale)
helper function which moves vertex into proper position
Definition vktextrenderer.cc:354
byte * vertexPtr
Definition vktextrenderer.h:65
virtual ~VkTextRenderer()
destructor
Definition vktextrenderer.cc:40
IndexT modelVar
Definition vktextrenderer.h:60
CoreGraphics::TextureId glyphTexture
Definition vktextrenderer.h:61
__DeclareClass(VkTextRenderer)
stbtt_fontinfo font
Definition vktextrenderer.h:55
CoreGraphics::ShaderProgramId program
Definition vktextrenderer.h:58
VkTextRenderer()
constructor
Definition vktextrenderer.cc:32
CoreGraphics::ResourceTableId textTable
Definition vktextrenderer.h:57
void Close()
close the device
Definition vktextrenderer.cc:160
CoreGraphics::BufferId vbo
Definition vktextrenderer.h:63
void Draw(const CoreGraphics::CmdBufferId cmdBuf, TextElementVertex *buffer, SizeT numChars)
draws text buffer
Definition vktextrenderer.cc:324
void Open()
open the device
Definition vktextrenderer.cc:54
CoreGraphics::PrimitiveGroup group
Definition vktextrenderer.h:62
__DeclareSingleton(VkTextRenderer)
Vulkan implementation of GPU acceleration structure.
Definition vkaccelerationstructure.cc:15
A resource table declares a list of resources (ResourceTable in DX12, DescriptorSet in Vulkan)
A shader represents an entire shader resource, containing several stages and programs.
Definition buffer.h:23
Definition commandbuffer.h:155
Definition resourcetable.h:95
texture type
Definition texture.h:25
Definition vertexlayout.h:16
Definition scalar.h:58
Definition scalar.h:76
A 2-component float vector class.
Definition vec2.h:21
Definition vktextrenderer.h:25
Math::float4 color
Definition vktextrenderer.h:28
Math::float2 vertex
Definition vktextrenderer.h:26
Math::float2 uv
Definition vktextrenderer.h:27
int SizeT
Definition types.h:49
int IndexT
Definition types.h:48