CloneableSmartAsset
interface allows use of cloneable smart asset management. Smart asset management requires cooperation from the {@link AssetKey}. In particular, the AssetKey should return {@link WeakRefCloneAssetCache} in its {@link AssetKey#getCacheType()} method. Also smart assets MUSTcreate a clone of the asset and cannot return the same reference, e.g. {@link AssetProcessor#createClone(java.lang.Object) createClone(someAsset)} != someAsset
.
If the {@link AssetManager#loadAsset(com.jme3.asset.AssetKey) } methodis called twice with the same asset key (equals() wise, not necessarily reference wise) then both assets will have the same asset key set (reference wise) via {@link AssetKey#AssetKey() }, then this asset key is used to track all instances of that asset. Once all clones of the asset are garbage collected, the shared asset key becomes unreachable and at that point it is removed from the smart asset cache.
|
|