ResourceManager.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include "ResourceManager.h"
  2. #include "Texture.h"
  3. #include "Material.h"
  4. #include "ShaderProg.h"
  5. #include "Mesh.h"
  6. #include "Skeleton.h"
  7. #include "SkelAnim.h"
  8. #include "LightData.h"
  9. #include "ParticleEmitterProps.h"
  10. #include "Script.h"
  11. #include "Model.h"
  12. #include "Skin.h"
  13. #include "DummyRsrc.h"
  14. // Because we are bored to write the same
  15. #define SPECIALIZE_TEMPLATE_STUFF(type__, container__) \
  16. template<> \
  17. ResourceManager::Types<type__>::Container& ResourceManager::choseContainer<type__>() \
  18. { \
  19. return container__; \
  20. } \
  21. \
  22. template<> \
  23. void ResourceManager::unload<type__>(const Types<type__>::Hook& hook) \
  24. { \
  25. unloadR<type__>(hook); \
  26. }
  27. SPECIALIZE_TEMPLATE_STUFF(Texture, textures)
  28. SPECIALIZE_TEMPLATE_STUFF(ShaderProg, shaderProgs)
  29. SPECIALIZE_TEMPLATE_STUFF(Material, materials)
  30. SPECIALIZE_TEMPLATE_STUFF(Mesh, meshes)
  31. SPECIALIZE_TEMPLATE_STUFF(Skeleton, skeletons)
  32. SPECIALIZE_TEMPLATE_STUFF(SkelAnim, skelAnims)
  33. SPECIALIZE_TEMPLATE_STUFF(LightData, lightProps)
  34. SPECIALIZE_TEMPLATE_STUFF(ParticleEmitterProps, particleEmitterProps)
  35. SPECIALIZE_TEMPLATE_STUFF(Script, scripts)
  36. SPECIALIZE_TEMPLATE_STUFF(Model, models)
  37. SPECIALIZE_TEMPLATE_STUFF(Skin, skins)
  38. SPECIALIZE_TEMPLATE_STUFF(DummyRsrc, dummies)