|
|
@@ -9,34 +9,17 @@
|
|
|
|
|
|
#include "scope_guard/scope_guard.hpp"
|
|
|
|
|
|
-#include <string>
|
|
|
-#include <unordered_map>
|
|
|
-
|
|
|
#pragma clang diagnostic push
|
|
|
#pragma clang diagnostic ignored "-Wcomma"
|
|
|
#define STB_IMAGE_IMPLEMENTATION
|
|
|
#include "stb/stb_image.h"
|
|
|
#pragma clang diagnostic pop
|
|
|
|
|
|
+#include "helper.hpp"
|
|
|
+
|
|
|
unsigned char * stbi_load(char const *, int *, int *, int *, int);
|
|
|
void stbi_image_free(void *);
|
|
|
|
|
|
-template <typename T, typename Key = std::string> class private_factory {
|
|
|
-public:
|
|
|
- using key_t = Key;
|
|
|
-
|
|
|
- template <typename... Args> static T create(key_t const & key) {
|
|
|
- auto found = instances.find(key);
|
|
|
- if (found == instances.end()) {
|
|
|
- found = instances.emplace(key, T::create(key)).first;
|
|
|
- }
|
|
|
- return found->second;
|
|
|
- }
|
|
|
-
|
|
|
-private:
|
|
|
- static std::unordered_map<key_t, T> instances;
|
|
|
-};
|
|
|
-
|
|
|
namespace graphics { namespace detail { namespace texture {
|
|
|
struct format {};
|
|
|
|