From 1ec7e17517ecba28a0713ce923a1c7cc03d2d61e Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Sat, 30 Dec 2023 03:26:06 -0500 Subject: [PATCH] working on major updates --- include/blt/gfx/renderer/batch_2d_renderer.h | 2 + include/blt/gfx/renderer/texture_manager.h | 49 ++++++++++++++++++++ libraries/BLT | 2 +- src/blt/gfx/renderer/texture_manager.cpp | 25 ++++++++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 include/blt/gfx/renderer/texture_manager.h create mode 100644 src/blt/gfx/renderer/texture_manager.cpp diff --git a/include/blt/gfx/renderer/batch_2d_renderer.h b/include/blt/gfx/renderer/batch_2d_renderer.h index 7865150..dff200f 100644 --- a/include/blt/gfx/renderer/batch_2d_renderer.h +++ b/include/blt/gfx/renderer/batch_2d_renderer.h @@ -22,6 +22,8 @@ namespace blt::gfx { + + } #endif //BLT_WITH_GRAPHICS_BATCH_2D_RENDERER_H diff --git a/include/blt/gfx/renderer/texture_manager.h b/include/blt/gfx/renderer/texture_manager.h new file mode 100644 index 0000000..efbd48c --- /dev/null +++ b/include/blt/gfx/renderer/texture_manager.h @@ -0,0 +1,49 @@ +/* + * + * Copyright (C) 2023 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BLT_WITH_GRAPHICS_TEXTURE_MANAGER_H +#define BLT_WITH_GRAPHICS_TEXTURE_MANAGER_H + +#include +#include +#include +#include + +namespace blt::gfx +{ + + struct loadable_texture + { + std::string path; + std::string name; + }; + + class texture_resource_manager + { + private: + blt::thread_pool pool; + std::vector textures_to_load; + HASHMAP textures_2d; + public: + texture_resource_manager() = default; + ~texture_resource_manager(); + }; + +} + +#endif //BLT_WITH_GRAPHICS_TEXTURE_MANAGER_H diff --git a/libraries/BLT b/libraries/BLT index cc64e71..d913e95 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit cc64e71c8d4ef550bad1eed5aaee3bd45fef9cad +Subproject commit d913e959658d9194be031b356bf815d766e06d80 diff --git a/src/blt/gfx/renderer/texture_manager.cpp b/src/blt/gfx/renderer/texture_manager.cpp new file mode 100644 index 0000000..1c7eedd --- /dev/null +++ b/src/blt/gfx/renderer/texture_manager.cpp @@ -0,0 +1,25 @@ +/* + * + * Copyright (C) 2023 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include + +blt::gfx::texture_resource_manager::~texture_resource_manager() +{ + for (const auto& p : textures_2d) + delete p.second; +}