| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsCorePrerequisites.h"
- #include "BsIReflectable.h"
- #include "BsCoreObject.h"
- namespace bs
- {
- /** @addtogroup Resources
- * @{
- */
- /** Base class for all resources. */
- class BS_CORE_EXPORT Resource : public IReflectable, public CoreObject
- {
- public:
- Resource(bool requiresGpuInitialization = true);
- virtual ~Resource() {};
- /** Returns the name of the resource. */
- const WString& getName() const;
- /** Sets the name of the resource. */
- void setName(const WString& name);
- /** Retrieves meta-data containing various information describing a resource. */
- SPtr<ResourceMetaData> getMetaData() const { return mMetaData; }
- /** 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;
- /** Retrieves a list of all resources that this resource depends on. */
- virtual void getResourceDependencies(FrameVector<HResource>& dependencies) const { }
- /** Checks if all the resources this object is dependent on are fully loaded. */
- bool areDependenciesLoaded() const;
- /**
- * Returns true if the resource can be compressed using a generic compression when saved on a storage device.
- * Certain resources already have their contents compressed (like audio files) and will not benefit from further
- * compression. Resources supporting streaming should never be compressed, instead such resources can handle
- * compression/decompression locally through their streams.
- */
- virtual bool isCompressible() const { return true; }
- UINT32 mSize;
- SPtr<ResourceMetaData> mMetaData;
- /**
- * Signal to the resource implementation if original data should be kept in memory. This is sometimes needed if
- * the resource destroys original data during normal usage, but it might still be required for special purposes
- * (like saving in the editor).
- */
- bool mKeepSourceData;
-
- /************************************************************************/
- /* SERIALIZATION */
- /************************************************************************/
- public:
- friend class ResourceRTTI;
- static RTTITypeBase* getRTTIStatic();
- RTTITypeBase* getRTTI() const override;
- };
- /** @} */
- }
|