BsResource.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. #include "BsIReflectable.h"
  6. #include "BsCoreObject.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Resources
  10. * @{
  11. */
  12. /** Base class for all resources. */
  13. class BS_CORE_EXPORT Resource : public IReflectable, public CoreObject
  14. {
  15. public:
  16. Resource(bool requiresGpuInitialization = true);
  17. virtual ~Resource() {};
  18. /** Returns the name of the resource. */
  19. const WString& getName() const;
  20. /** Sets the name of the resource. */
  21. void setName(const WString& name);
  22. /** Retrieves meta-data containing various information describing a resource. */
  23. ResourceMetaDataPtr getMetaData() const { return mMetaData; }
  24. /** Returns whether or not this resource is allowed to be asynchronously loaded. */
  25. virtual bool allowAsyncLoading() const { return true; }
  26. protected:
  27. friend class Resources;
  28. friend class ResourceHandleBase;
  29. /** Retrieves a list of all resources that this resource depends on. */
  30. virtual void getResourceDependencies(FrameVector<HResource>& dependencies) const { }
  31. /** Checks if all the resources this object is dependent on are fully loaded. */
  32. bool areDependenciesLoaded() const;
  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 override;
  42. };
  43. /** @} */
  44. }