diff options
-rw-r--r-- | gfx/models/texture.cpp | 7 | ||||
-rw-r--r-- | gfx/models/texture.h | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/gfx/models/texture.cpp b/gfx/models/texture.cpp index 79376bc..cff44f9 100644 --- a/gfx/models/texture.cpp +++ b/gfx/models/texture.cpp @@ -8,10 +8,13 @@ Cache<Texture, std::filesystem::path> Texture::cachedTexture;
-Texture::Texture(const std::filesystem::path & fileName)
+Texture::Texture(const std::filesystem::path & fileName) :
+ Texture {Image {Resource::mapPath(fileName).c_str(), STBI_rgb_alpha}}
{
- const Image tex {Resource::mapPath(fileName).c_str(), STBI_rgb_alpha};
+}
+Texture::Texture(const Image & tex)
+{
glBindTexture(GL_TEXTURE_2D, m_texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
diff --git a/gfx/models/texture.h b/gfx/models/texture.h index 04aa9ec..8f93a42 100644 --- a/gfx/models/texture.h +++ b/gfx/models/texture.h @@ -5,10 +5,12 @@ #include <glArrays.h>
// IWYU pragma: no_forward_declare Cache
+class Image;
class Texture {
public:
explicit Texture(const std::filesystem::path & fileName);
+ explicit Texture(const Image & image);
static Cache<Texture, std::filesystem::path> cachedTexture;
|