| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #pragma once
- #include "BsCorePrerequisites.h"
- #include "BsIReflectable.h"
- #include "BsCoreObject.h"
- namespace BansheeEngine
- {
- /**
- * @brief Base class for all resources.
- */
- class BS_CORE_EXPORT Resource : public IReflectable, public CoreObject
- {
- public:
- Resource(bool requiresGpuInitialization = true);
- virtual ~Resource() {};
- /**
- * @brief Returns the name of the resource.
- */
- const WString& getName() const;
- /**
- * @brief Sets the name of the resource.
- */
- void setName(const WString& name);
- /**
- * @brief Retrieves meta-data containing various information describing a resource.
- */
- ResourceMetaDataPtr getMetaData() const { return mMetaData; }
- /**
- * @brief Returns whether or not this resource is allowed to be asynchronously loaded.
- */
- virtual bool allowAsyncLoading() const { return true; }
- protected:
- friend class Resources;
- friend class ResourceHandleBase;
- /**
- * @brief Retrieves a list of all resources that this resource depends on.
- *
- * TODO - Consider using a stack-allocated data type since returned data is almost
- * always transient. Then we can save on memory allocations.
- */
- virtual void getResourceDependencies(Vector<HResource>& dependencies) const { }
- /**
- * @brief Checks if all the resources this object is dependent on are fully loaded.
- */
- bool areDependenciesLoaded() const;
- UINT32 mSize;
- ResourceMetaDataPtr mMetaData;
- /************************************************************************/
- /* SERIALIZATION */
- /************************************************************************/
- public:
- friend class ResourceRTTI;
- static RTTITypeBase* getRTTIStatic();
- virtual RTTITypeBase* getRTTI() const;
- };
- }
|