An abstract class for a generic asset
This class is the base class for any generic asset (such as a model file or level layout) not explicitly included in the existing asset classes. It has abstract methods for loading and unloading from a file, which any subclass should implement.
This class SHOULD NOT make any references to AssetManager in the load/unload methods. Assets should be treated as if they load in parallel, not in sequence. Therefore, it is unsafe to assume that one asset loads before another. If this asset needs to connect to other assets (sound, images, etc.) this should take place after asset loading, such as during scene graph initialization or the like.
virtual bool Asset::load |
( |
| ) |
|
|
pure virtual |
Returns true after successfully loading from a file.
This method is abstract. All subclasses should provide an implementation of this method. This method is necessary for an Asset to be used with an instance of GenericLoader.
This load method should NEVER access the AssetManager. Assets are loaded in parallel, not in sequence. If an asset (like a game level) has references to other assets, then these should be connected later, such as during scene graph initialization.
- Returns
- true if successfully loaded the asset from a file
virtual void Asset::unload |
( |
| ) |
|
|
inlinevirtual |
Unloads all resources attached to this file.
This method is abstract. All subclasses should provide an implementation of this method. This method is necessary for an Asset to be used with an instance of GenericLoader.
This load method should NEVER access the AssetManager. Assets are loaded and unloaded in parallel, not in sequence. If an asset (like a game level) has references to other assets, then these should be disconnected earlier.