9 #include "imstkTexture.h" 10 #include "imstkTextureDelegate.h" 12 #include <unordered_map> 25 static_assert(std::is_base_of<TextureDelegate, T>::value,
"T isn't a subclass of TextureDelegate");
30 std::shared_ptr<T> getTextureDelegate(std::shared_ptr<Texture> texture);
33 std::unordered_map<std::shared_ptr<Texture>, std::shared_ptr<T>> m_textureMap;
36 template<
class T> std::shared_ptr<T>
40 if (m_textureMap.count(texture) == 0)
42 m_textureMap[texture] = std::make_shared<T>();
43 m_textureMap[texture]->initialize(texture);
45 return m_textureMap[texture];
The TextureManager provides delegates for textures, it will create new ones and cache old ones...