mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
working on text render pipeline
This commit is contained in:
@@ -68,7 +68,7 @@ namespace mlx::core
|
||||
|
||||
void Application::stringPut(void* win, int x, int y, int color, char* str)
|
||||
{
|
||||
|
||||
_graphics[*static_cast<int*>(win)]->stringPut(x, y, color, str);
|
||||
}
|
||||
|
||||
void Application::texturePut(void* win, void* img, int x, int y)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/02 15:13:55 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/06 16:39:13 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/08 00:19:18 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -16,13 +16,13 @@ namespace mlx
|
||||
{
|
||||
GraphicsSupport::GraphicsSupport(std::size_t w, std::size_t h, std::string title, int id) :
|
||||
_window(std::make_shared<MLX_Window>(w, h, std::move(title))),
|
||||
_renderer(std::make_unique<Renderer>()),
|
||||
_renderer(std::make_unique<Renderer>()), _text_put_pipeline(std::make_unique<TextPutPipeline>()),
|
||||
_id(id)
|
||||
{
|
||||
_renderer->setWindow(_window.get());
|
||||
_renderer->init();
|
||||
_pixel_put_pipeline.init(w, h, *_renderer);
|
||||
_text_put_pipeline.init(*_renderer);
|
||||
_text_put_pipeline->init(_renderer.get());
|
||||
}
|
||||
|
||||
void GraphicsSupport::endRender() noexcept
|
||||
@@ -49,6 +49,11 @@ namespace mlx
|
||||
sets.push_back(_pixel_put_pipeline.getDescriptorSet());
|
||||
vkCmdBindDescriptorSets(cmd_buff, VK_PIPELINE_BIND_POINT_GRAPHICS, _renderer->getPipeline().getPipelineLayout(), 0, sets.size(), sets.data(), 0, nullptr);
|
||||
_pixel_put_pipeline.render(*_renderer);
|
||||
sets.pop_back();
|
||||
|
||||
sets.push_back(_text_put_pipeline->getDescriptorSet());
|
||||
vkCmdBindDescriptorSets(cmd_buff, VK_PIPELINE_BIND_POINT_GRAPHICS, _renderer->getPipeline().getPipelineLayout(), 0, sets.size(), sets.data(), 0, nullptr);
|
||||
_text_put_pipeline->render();
|
||||
|
||||
_renderer->endFrame();
|
||||
|
||||
@@ -60,6 +65,7 @@ namespace mlx
|
||||
{
|
||||
vkDeviceWaitIdle(Render_Core::get().getDevice().get());
|
||||
_pixel_put_pipeline.destroy();
|
||||
_text_put_pipeline->destroy();
|
||||
_renderer->destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/02 14:49:49 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/06 19:01:12 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/04/08 01:14:22 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -50,9 +50,9 @@ namespace mlx
|
||||
private:
|
||||
std::unordered_set<TextureRenderData> _textures_to_render;
|
||||
PixelPutPipeline _pixel_put_pipeline;
|
||||
TextPutPipeline _text_put_pipeline;
|
||||
glm::mat4 _proj = glm::mat4(1.0);
|
||||
std::shared_ptr<MLX_Window> _window;
|
||||
std::unique_ptr<TextPutPipeline> _text_put_pipeline; // unique_ptr because of the size of the class
|
||||
std::unique_ptr<Renderer> _renderer;
|
||||
int _id;
|
||||
};
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace mlx
|
||||
{
|
||||
_textures_to_render.clear();
|
||||
_pixel_put_pipeline.clear();
|
||||
_text_put_pipeline.clear();
|
||||
}
|
||||
|
||||
void GraphicsSupport::pixelPut(int x, int y, int color) noexcept
|
||||
@@ -38,7 +39,7 @@ namespace mlx
|
||||
|
||||
void GraphicsSupport::stringPut(int x, int y, int color, std::string str)
|
||||
{
|
||||
_text_put_pipeline.put(x, y, color, str);
|
||||
_text_put_pipeline->put(x, y, color, str);
|
||||
}
|
||||
|
||||
void GraphicsSupport::texturePut(std::shared_ptr<Texture> texture, int x, int y)
|
||||
|
||||
Reference in New Issue
Block a user