• Articles
  • Api Documentation
Show / Hide Table of Contents
  • net.abi.abisEngine.components
    • Camera
    • DirectionalLight
    • FreeLook
    • FreeMove
    • Light
    • LockView
    • MeshRenderer
    • PointLight
    • SceneComponent
    • SpotLight
  • net.abi.abisEngine.core
    • CoreEngine
    • Main
    • Time
  • net.abi.abisEngine.entities
    • Entity
    • EntityI
  • net.abi.abisEngine.handlers.file
    • FileHandler
    • PathHandle
    • PathResolveI
    • PathType
  • net.abi.abisEngine.handlers.logging
    • Logger
    • LogLevel
    • LogManager
  • net.abi.abisEngine.input
    • GLFWInput
    • GLFWMouseAndKeyboardInput
  • net.abi.abisEngine.math
    • Math
    • Matrix
    • Matrix4f
    • Quaternion
    • Transform
    • Vector2f
    • Vector2i
    • Vector3f
    • Vector3i
    • Vector4f
    • Vector4fI
  • net.abi.abisEngine.rendering.asset
    • AssetClassifier
    • AssetContainer
    • AssetI
    • AssetLoaderParameters
    • AssetLoaderParameters.LoadedCallback
    • AssetLoadTask
    • AssetManager
    • AssetStore
    • TaskCompleteHandler
  • net.abi.abisEngine.rendering.asset.loaders
    • AssetLoader
    • AsyncAssetLoader
    • ModelSceneLoader
    • ModelSceneLoader.Parameter
    • SyncAssetLoader
  • net.abi.abisEngine.rendering.image
    • AEImage
    • ImageMetaData
    • PixelMap
  • net.abi.abisEngine.rendering.material
    • Material
  • net.abi.abisEngine.rendering.mesh
    • AIMeshLoader
    • Mesh
    • MeshResource
    • Model
    • ModelScene
    • Vertex
  • net.abi.abisEngine.rendering.pipeline
    • RenderingEngine
  • net.abi.abisEngine.rendering.scene
    • Scene
    • SceneManager
  • net.abi.abisEngine.rendering.scene.scenes
    • EngineSplashScreen
  • net.abi.abisEngine.rendering.shader
    • AEShader
    • AEShader.AEShaderType
    • AEShaderResource
    • ForwardAmbientShader
    • ForwardDirectionalShader
    • ForwardPointShader
    • ForwardSpotShader
    • GLSLLayoutQualifier
    • GLSLUniform
    • GLSLUniformBlockObject
    • GLSLUniformBlockObjectData
    • Shader
    • Shader.ShaderSource
    • Shader.ShaderType
    • ShaderResource
    • WireFrameShader
  • net.abi.abisEngine.rendering.shader.compiler
    • AEGLInfo
    • AEShaderCompiler
    • AEShaderCompiler.GLSLStruct
    • AEShaderCompiler.ShaderData
    • AEShaderCompiler.ShaderSource
    • Tokens
    • Tokens.Keywords
    • Tokens.Operators
    • Tokens.Qualifiers
  • net.abi.abisEngine.rendering.shader.loader
    • AEShaderLoader
  • net.abi.abisEngine.rendering.shader.parser
    • AEShaderParserYAML
  • net.abi.abisEngine.rendering.shader.parser.fileTypes.yaml
    • AEDemoProperty
    • AEPrepProperty
    • AEShaderFileYAML
    • AEShaderGLSLProgram
    • AEShaderPass
  • net.abi.abisEngine.rendering.texture
    • Texture
    • Texture.TextureData
    • TextureResource
  • net.abi.abisEngine.rendering.window
    • GLFWWindow
    • GLFWWindow.AnimatedCursor
    • GLFWWindow.CursorI
    • GLFWWindow.GLFWWindowProperties
    • GLFWWindow.StaticCursor
    • GLFWWindow.StaticCursorResource
    • GLFWWindowManager
    • GLFWWindowManager.GLFWWindowContext
  • net.abi.abisEngine.rendering.window.models
    • EngineLoader
  • net.abi.abisEngine.util
    • Attenuation
    • Color
    • Expendable
    • IOUtil
    • MappedValues
    • ThreadUtils
    • Util
  • net.abi.abisEngine.util.async
    • Async
    • AsyncResult
    • AsyncTask
    • AsyncThreadDispatcher
  • net.abi.abisEngine.util.cacheing
    • GenericCache
    • GenericCacheI
    • TwoFactorGenericCache
    • TwoFactorGenericCacheI
  • net.abi.abisEngine.util.exceptions
    • AECursorInitializationException
    • AEException
    • AEGLFWWindowInitializationException
    • AEImageManipulationException
    • AEIOException
    • AERuntimeException
    • AEShaderCompilerRuntimeException
  • tests.renderTest
    • Start
  • tests.renderTest.entitys
    • FlatPlane
    • MonkeyHead
  • tests.renderTest.materials
    • BricksOne
    • BricksTwo
  • tests.renderTest.scenes
    • MainMenu
    • TestGame
  • tests.renderTest.windows
    • MainGame

Class AssetManager

Inheritance
java.lang.Object
Expendable
AssetManager
Syntax
public class AssetManager implements Expendable

Constructors

AssetManager(long context)

Creates a new AssetManager with all default loaders.

Declaration
public AssetManager(long context)
Parameters
Type Name Description
long context

AssetManager(String assetsDir, boolean defaultLoaders)

Creates a new AssetManager with optionally all default loaders. If you don't add the default loaders then you do have to manually add the loaders you need, including any loaders they might depend on.

Declaration
public AssetManager(String assetsDir, boolean defaultLoaders)
Parameters
Type Name Description
String assetsDir
boolean defaultLoaders

whether to add the default loaders

Methods

addAsset(final String fileName, Class<T> type, T asset)

Adds an asset to this AssetManager

Declaration
protected <T> AssetContainer addAsset(final String fileName, Class<T> type, T asset)
Parameters
Type Name Description
final String fileName
Class<T> type
T asset
Returns
Type Description
<T> AssetContainer

clear()

Clears and disposes all assets and the preloading queue.

Declaration
public synchronized void clear()
Returns
Type Description
synchronized void

contains(String fileName)

Returns true if an asset with the specified name is loading, queued to be loaded, or has been loaded.

Declaration
public synchronized boolean contains(String fileName)
Parameters
Type Name Description
String fileName
Returns
Type Description
synchronized boolean

contains(String fileName, Class type)

Returns true if an asset with the specified name and type is loading, queued to be loaded, or has been loaded.

Declaration
public synchronized boolean contains(String fileName, Class type)
Parameters
Type Name Description
String fileName
Class type
Returns
Type Description
synchronized boolean

containsAsset(String name)

Declaration
public synchronized<T> boolean containsAsset(String name)
Parameters
Type Name Description
String name
Returns
Type Description
synchronized<T> boolean

whether the asset is contained in this manager

dispose()

Disposes all assets in the manager and stops all asynchronous loading.

Declaration
public synchronized void dispose()
Returns
Type Description
synchronized void
Overrides
Expendable.dispose()

finishLoading()

Blocks until all assets are loaded.

Declaration
public void finishLoading()

finishLoadingAsset(AssetClassifier assetDesc)

Blocks until the specified asset is loaded.

Declaration
public <T> T finishLoadingAsset(AssetClassifier assetDesc)
Parameters
Type Name Description
AssetClassifier<T> assetDesc

the AssetClassifier of the asset

Returns
Type Description
<T> T

finishLoadingAsset(String fileName)

Blocks until the specified asset is loaded.

Declaration
public synchronized<T> T finishLoadingAsset(String fileName)
Parameters
Type Name Description
String fileName

the file name (interpretation depends on AssetLoader)

Returns
Type Description
synchronized<T> T

get(AssetClassifier<T> assetDescriptor)

Declaration
public synchronized<T> T get(AssetClassifier<T> assetDescriptor)
Parameters
Type Name Description
AssetClassifier<T> assetDescriptor

the asset descriptor

Returns
Type Description
synchronized<T> T

the asset

get(String fileName)

Declaration
public synchronized<T> T get(String fileName)
Parameters
Type Name Description
String fileName

the asset file name

Returns
Type Description
synchronized<T> T

the asset

get(String fileName, Class<T> type)

Declaration
public synchronized<T> T get(String fileName, Class<T> type)
Parameters
Type Name Description
String fileName

the asset file name

Class<T> type

the asset type

Returns
Type Description
synchronized<T> T

the asset

getAll(Class<T> type)

Declaration
public synchronized<T> ArrayList<T> getAll(Class<T> type)
Parameters
Type Name Description
Class<T> type

the asset type

Returns
Type Description
synchronized<T> ArrayList<T>

all the assets matching the specified type

getAssetsDir()

Declaration
public String getAssetsDir()
Returns
Type Description
String

getGlfw_handle()

Declaration
public long getGlfw_handle()
Returns
Type Description
long

getLoadedAssets()

Declaration
public synchronized int getLoadedAssets()
Returns
Type Description
synchronized int

the number of loaded assets

getLoader(final Class<T> type)

Returns the default loader for the given type

Declaration
public <T> AssetLoader getLoader(final Class<T> type)
Parameters
Type Name Description
final Class<T> type

The type of the loader to get

Returns
Type Description
<T> AssetLoader

The loader capable of loading the type, or null if none exists

getLoader(final Class<T> type, final String fileName)

Returns the loader for the given type and the specified filename. If no loader exists for the specific filename, the default loader for that type is returned.

Declaration
public <T> AssetLoader getLoader(final Class<T> type, final String fileName)
Parameters
Type Name Description
final Class<T> type

The type of the loader to get

final String fileName

The filename of the asset to get a loader for, or null to get the default loader

Returns
Type Description
<T> AssetLoader

The loader capable of loading the type and filename, or null if none exists

getProgress()

Declaration
public synchronized float getProgress()
Returns
Type Description
synchronized float

the progress in percent of completion.

getQueuedAssets()

Declaration
public synchronized int getQueuedAssets()
Returns
Type Description
synchronized int

the number of currently queued assets

getReferenceCount(String fileName)

Returns the reference count of an asset.

Declaration
public synchronized int getReferenceCount(String fileName)
Parameters
Type Name Description
String fileName
Returns
Type Description
synchronized int

isFinished()

Returns true when all assets are loaded. Can be called from any thread but note update() or related methods must be called to process tasks.

Declaration
public synchronized boolean isFinished()
Returns
Type Description
synchronized boolean

isLoaded(AssetClassifier assetDesc)

Declaration
public synchronized boolean isLoaded(AssetClassifier assetDesc)
Parameters
Type Name Description
AssetClassifier<T> assetDesc

the AssetClassifier of the asset

Returns
Type Description
synchronized boolean

the filename of the asset or null

isLoaded(String fileName)

Declaration
public synchronized boolean isLoaded(String fileName)
Parameters
Type Name Description
String fileName

the file name of the asset

Returns
Type Description
synchronized boolean

whether the asset is loaded

isLoaded(String fileName, Class type)

Declaration
public synchronized boolean isLoaded(String fileName, Class type)
Parameters
Type Name Description
String fileName

the file name of the asset

Class type
Returns
Type Description
synchronized boolean

whether the asset is loaded

load(AssetClassifier desc)

Adds the given asset to the loading queue of the AssetManager.

Declaration
public synchronized void load(AssetClassifier desc)
Parameters
Type Name Description
AssetClassifier<T> desc

the AssetClassifier

Returns
Type Description
synchronized void

load(String fileName, Class<T> type)

Adds the given asset to the loading queue of the AssetManager.

Declaration
public synchronized<T> void load(String fileName, Class<T> type)
Parameters
Type Name Description
String fileName

the file name (interpretation depends on AssetLoader)

Class<T> type

the type of the asset.

Returns
Type Description
synchronized<T> void

load(String fileName, Class<T> type, AssetLoaderParameters<T> parameter)

Adds the given asset to the loading queue of the AssetManager.

Declaration
public synchronized<T> void load(String fileName, Class<T> type, AssetLoaderParameters<T> parameter)
Parameters
Type Name Description
String fileName

the file name (interpretation depends on AssetLoader)

Class<T> type

the type of the asset.

AssetLoaderParameters<T> parameter

parameters for the AssetLoader.

Returns
Type Description
synchronized<T> void

setLoader(Class<T> type, AssetLoader<T, P> loader)

Sets a new AssetLoader for the given type.

Declaration
public synchronized<T, P extends AssetLoaderParameters<T>> void setLoader(Class<T> type, AssetLoader<T, P> loader)
Parameters
Type Name Description
Class<T> type

the type of the asset

AssetLoader<T, P> loader

the loader

Returns
Type Description
synchronized<T, P extends AssetLoaderParameters<T>> void

setLoader(Class<T> type, String suffix, AssetLoader<T, P> loader)

Sets a new AssetLoader for the given type.

Declaration
public synchronized<T, P extends AssetLoaderParameters<T>> void setLoader(Class<T> type, String suffix, AssetLoader<T, P> loader)
Parameters
Type Name Description
Class<T> type

the type of the asset

String suffix

the suffix the filename must have for this loader to be used or null to specify the default loader.

AssetLoader<T, P> loader

the loader

Returns
Type Description
synchronized<T, P extends AssetLoaderParameters<T>> void

taskFailed(AssetClassifier assetDesc, RuntimeException ex)

Called when a task throws an exception during loading. The default implementation rethrows the exception. A subclass may supress the default implementation when loading assets where loading failure is recoverable.

Declaration
protected void taskFailed(AssetClassifier assetDesc, RuntimeException ex)
Parameters
Type Name Description
AssetClassifier<T> assetDesc
RuntimeException ex

unload(String fileName)

Removes the asset and all its dependencies, if they are not used by other assets.

Declaration
public synchronized void unload(String fileName)
Parameters
Type Name Description
String fileName

the file name

Returns
Type Description
synchronized void

update()

Updates the AssetManager for a single task. Returns if the current task is still being processed or there are no tasks, otherwise it finishes the current task and starts the next task.

Declaration
public synchronized boolean update()
Returns
Type Description
synchronized boolean

true if all loading is finished.

Back to top Generated by DocFX