diff --git a/src/gfx/texture.cpp b/src/gfx/texture.cpp index 91fb472..b036576 100644 --- a/src/gfx/texture.cpp +++ b/src/gfx/texture.cpp @@ -2,6 +2,7 @@ #include #include "utils/files.hpp" +#include "assets/cmdfile.hpp" #define STB_IMAGE_IMPLEMENTATION #include @@ -76,9 +77,27 @@ std::shared_ptr gfx::Texture::LoadFromFile(const std::string& file throw std::runtime_error("Failed to load texture from file: " + filename); } + bool mipmaps = true; + bool linear = false; + + std::string config_path = filename + ".cfg"; + if (fs::FileExists(config_path)) + { + assets::LoadCMDFile(config_path, [&](const std::string& command, std::istringstream& iss) { + if (command == "nomipmaps") + { + mipmaps = false; + } + else if (command == "linear") + { + linear = true; + } + }); + } + std::shared_ptr texture; try { - texture = std::make_shared(width, height, data, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, false, false); + texture = std::make_shared(width, height, data, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, linear, mipmaps); } catch (const std::exception& e) { stbi_image_free(data);