CmResource.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include "CmResource.h"
  2. #include "CmResourceST.h"
  3. namespace CamelotEngine
  4. {
  5. //void Resource::unload()
  6. //{
  7. // // Early-out without lock (mitigate perf cost of ensuring unloaded)
  8. // LoadingState old = mLoadingState.get();
  9. // if (old!=LOADSTATE_LOADED && old!=LOADSTATE_PREPARED) return;
  10. // if (!mLoadingState.cas(old,LOADSTATE_UNLOADING)) return;
  11. // // Scope lock for actual unload
  12. // {
  13. // OGRE_LOCK_AUTO_MUTEX
  14. // if (old==LOADSTATE_PREPARED) {
  15. // unprepareImpl();
  16. // } else {
  17. // preUnloadImpl();
  18. // unloadImpl();
  19. // postUnloadImpl();
  20. // }
  21. // }
  22. // mLoadingState.set(LOADSTATE_UNLOADED);
  23. // // Notify manager
  24. // // Note if we have gone from PREPARED to UNLOADED, then we haven't actually
  25. // // unloaded, i.e. there is no memory freed on the GPU.
  26. // if(old==LOADSTATE_LOADED && mCreator)
  27. // mCreator->_notifyResourceUnloaded(this);
  28. // _fireUnloadingComplete();
  29. //}
  30. ////-----------------------------------------------------------------------
  31. //void Resource::reload()
  32. //{
  33. // OGRE_LOCK_AUTO_MUTEX
  34. // if (mLoadingState.get() == LOADSTATE_LOADED)
  35. // {
  36. // unload();
  37. // load();
  38. // }
  39. //}
  40. SerializableType* Resource::getSerializable() const
  41. {
  42. static ResourceST serializableType;
  43. return &serializableType;
  44. }
  45. Resource* newObject()
  46. {
  47. CM_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");
  48. }
  49. }