diff options
Diffstat (limited to 'assetFactory')
-rw-r--r-- | assetFactory/texturePacker.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/assetFactory/texturePacker.cpp b/assetFactory/texturePacker.cpp index 68a6010..30f1c37 100644 --- a/assetFactory/texturePacker.cpp +++ b/assetFactory/texturePacker.cpp @@ -1,7 +1,9 @@ #include "texturePacker.h" #include "collections.hpp" +#include <GL/glew.h> #include <algorithm> #include <cstdio> +#include <glm/common.hpp> #include <numeric> #include <ostream> #include <set> @@ -55,6 +57,17 @@ TexturePacker::pack(Size size) const } } } + if (GLEW_ARB_texture_non_power_of_two) { + // Crop the size back to minimum size + size = std::transform_reduce( + result.begin(), result.end(), inputImages.begin(), Size {}, + [](auto && max, auto && limit) { + return glm::max(max, limit); + }, + [](auto && pos, auto && size) { + return pos + size; + }); + } return {result, size}; } |