BsResource.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. #include "BsIReflectable.h"
  4. #include "BsCoreObject.h"
  5. namespace BansheeEngine
  6. {
  7. /**
  8. * @brief Base class for all resources.
  9. */
  10. class BS_CORE_EXPORT Resource : public IReflectable, public CoreObject
  11. {
  12. public:
  13. Resource(bool requiresGpuInitialization = true);
  14. virtual ~Resource() {};
  15. /**
  16. * @brief Returns the name of the resource.
  17. */
  18. const WString& getName() const;
  19. /**
  20. * @brief Sets the name of the resource.
  21. */
  22. void setName(const WString& name);
  23. /**
  24. * @brief Retrieves meta-data containing various information describing a resource.
  25. */
  26. ResourceMetaDataPtr getMetaData() const { return mMetaData; }
  27. /**
  28. * @brief Returns whether or not this resource is allowed to be asynchronously loaded.
  29. */
  30. virtual bool allowAsyncLoading() const { return true; }
  31. protected:
  32. friend class Resources;
  33. UINT32 mSize;
  34. ResourceMetaDataPtr mMetaData;
  35. /************************************************************************/
  36. /* SERIALIZATION */
  37. /************************************************************************/
  38. public:
  39. friend class ResourceRTTI;
  40. static RTTITypeBase* getRTTIStatic();
  41. virtual RTTITypeBase* getRTTI() const;
  42. };
  43. }