working on text render pipeline

This commit is contained in:
2023-04-08 04:09:25 +02:00
parent 77e8672754
commit 157a099ed2
11 changed files with 8202 additions and 29 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/06 16:24:11 by maldavid #+# #+# */
/* Updated: 2023/04/07 17:11:08 by maldavid ### ########.fr */
/* Updated: 2023/04/08 00:46:36 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,6 +18,7 @@
#include <string>
#include <stb_truetype.h>
#include <cstdint>
#include <vector>
namespace mlx
{
@@ -28,13 +29,29 @@ namespace mlx
void init(Renderer* renderer) noexcept;
void put(int x, int y, int color, std::string str);
inline VkDescriptorSet getDescriptorSet() noexcept { return _atlas.getSet(); }
inline void clear() { _drawlist.clear(); }
void render();
void destroy() noexcept;
~TextPutPipeline() = default;
private:
struct DrawList
{
std::string text;
float x;
float y;
int color;
DrawList(std::string _text, int _color, int _x, int _y) :
text(std::move(_text)), color(_color), x(_x), y(_y)
{}
};
stbtt_bakedchar _cdata[96];
TextureAtlas _atlas;
std::vector<DrawList> _drawlist;
Renderer* _renderer = nullptr;
};
}