From 00649a055db2653c1ec0d98e31345290d9b28120 Mon Sep 17 00:00:00 2001 From: Brett Date: Mon, 8 Jan 2024 21:34:14 -0500 Subject: [PATCH] allow for direct setting of the texture_2d --- include/blt/gfx/model.h | 1 + include/blt/gfx/renderer/resource_manager.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/blt/gfx/model.h b/include/blt/gfx/model.h index 79383bb..82dcbfd 100644 --- a/include/blt/gfx/model.h +++ b/include/blt/gfx/model.h @@ -156,6 +156,7 @@ namespace blt::gfx * @return a shared pointer to the stored vbo. used for chaining VAOs with multiple shared VBOs */ static_dynamic_array::vbo_type bindVBO(const vbo_t& vbo, int attribute_number, int coordinate_size, GLenum type, int stride, long offset); + // same as the other bind method except you provide the shared reference. void bindVBO(const static_dynamic_array::vbo_type& vbo, int attribute_number, int coordinate_size, GLenum type, int stride, long offset); inline void bindElement(const vbo_t& vbo) diff --git a/include/blt/gfx/renderer/resource_manager.h b/include/blt/gfx/renderer/resource_manager.h index d1273b6..3bbeb05 100644 --- a/include/blt/gfx/renderer/resource_manager.h +++ b/include/blt/gfx/renderer/resource_manager.h @@ -63,6 +63,15 @@ namespace blt::gfx return textures_2d[name]; } + /** + * Directly sets the internal representation of the texture. Can be used to set custom, non file system loaded textures. + * Note: this function takes ownership of the ptr. + */ + inline void set(std::string_view name, texture_gl2D* texture) + { + textures_2d[name] = texture; + } + void cleanup(); };