public class AssetManager extends java.lang.Object implements OnLoadListener<Texture>
| Modifier and Type | Field and Description |
|---|---|
AnimGraphLibrary |
animGraphs
AnimGraph library
|
java.lang.ClassLoader |
context
ClassLoader which may be used by asynchronous loading task to resolve resources |
MaterialLibrary |
materials
Material library
|
ModelLibrary |
models
Model library
|
MotionLibrary |
motions
Motion library
|
ShaderList |
shaders
Optional: List of shaders
|
SplineLibrary |
splines
Spline library
|
TextureList |
textures
List of textures
|
| Constructor and Description |
|---|
AssetManager() |
| Modifier and Type | Method and Description |
|---|---|
static AssetManager |
create() |
static AssetManager |
create(boolean concurrent) |
void |
destroy(IGL gl)
Destroy AsyncModel/Texture/Shader with a reference count of 0,
and all AsyncMotion, MaterialAdvanced
|
void |
destroy(IGL gl,
boolean force)
Destroy all assets if
force set to true,
if false equivalent to #destroy(IGLApi) |
void |
generateShadersAsync(Model model)
Force asynchronous shader generation to the specified
Model. |
Finder |
getShaderFinder() |
ShaderGenerator |
getShaderGenerator() |
Finder |
getTextureFinder() |
boolean |
hasAsyncModelLoaded() |
boolean |
hasAsyncMotionLoaded() |
boolean |
isReadTextureAsync() |
boolean |
isWorking() |
Model |
loadModel(ModelReaderSettings settings)
Deprecated.
|
AsyncModel |
loadModelAsync(ModelReaderSettings settings)
Deprecated.
use
ModelLibrary.use(AssetManager, ModelReaderSettings), or to bypass ModelLibrary use the AsyncModel constructor directly. |
AsyncModel |
loadModelAsyncWithCache(ModelReaderSettings settings)
Load model asynchronously using download cache
|
Motion |
loadMotion(ReaderSettings settings)
Load a motion, and store in
#motions if assigned. |
AsyncMotion |
loadMotionAsync(ReaderSettings settings)
Asynchronous
Motion loading. |
AsyncMotion |
loadMotionAsyncWithCache(ReaderSettings settings)
Load motion asynchronously using download cache
|
void |
loadShaders() |
void |
loadShaders(Model model) |
void |
onContextLost()
The be called when the OpenGL context has been lost
|
void |
onContextLost(Model model)
Must be called after
onContextLost() |
void |
onLoad(Texture texture) |
void |
onMaterialChanged(Mesh mesh,
IMaterial material)
|
void |
onMaterialChanged(Model model,
MaterialStandard material)
Internal use
Notifies a MaterialStandard has a shader changed |
void |
readAndLoadTextures(IGL gl,
Model model)
Deprecated.
|
void |
readTextureAsync(Texture texture,
TextureParam textureParam)
Asynchronous read textures specified
|
void |
readTextures(Model model)
Synchronous texture read of all textures of the
Model |
void |
readTexturesAsync()
Asynchronous read all textures in this
AssetManager |
void |
readTexturesAsync(Model model)
Asynchronous read all textures of the specified
Model |
void |
setReadTextureAsync(boolean readTextureAsync)
Automatically queue asynchronous texture read when a
Model has been loaded |
void |
setShaderGenerator(ShaderGenerator shaderGenerator)
Automatically queue asynchronous shader generation when a
Texture has been loaded |
public TextureList textures
public ShaderList shaders
public ModelLibrary models
public MotionLibrary motions
public SplineLibrary splines
public MaterialLibrary materials
public AnimGraphLibrary animGraphs
public java.lang.ClassLoader context
ClassLoader which may be used by asynchronous loading task to resolve resourcespublic static AssetManager create()
AssetManager with a TextureList, ShaderList,
MaterialLibrary, ModelLibrary. Asynchronous texture and shader is enabled.public static AssetManager create(boolean concurrent)
concurrent - true to support concurrent assets modificationsAssetManager with a TextureList, ShaderList,
MaterialLibrary, ModelLibrary. Asynchronous texture and shader is enabled.public final boolean isWorking()
public final void setReadTextureAsync(boolean readTextureAsync)
Model has been loadedpublic final boolean isReadTextureAsync()
public final void setShaderGenerator(ShaderGenerator shaderGenerator)
Texture has been loadedjava.lang.IllegalStateException - if textures is not setpublic final ShaderGenerator getShaderGenerator()
@Deprecated public final Model loadModel(ModelReaderSettings settings) throws java.io.IOException
loadModelAsync(ModelReaderSettings)AsyncModel asyncModel = assets.loadModelAsync(settings); Model model = asyncModel.getSync(); asyncModel.release(); return model;
settings - java.io.IOException - if an exception occurs while loadingloadModelAsync(ModelReaderSettings)@Deprecated public final AsyncModel loadModelAsync(ModelReaderSettings settings)
ModelLibrary.use(AssetManager, ModelReaderSettings), or to bypass ModelLibrary use the AsyncModel constructor directly.settings - ModelReaderSettings of the model to loadAsyncModel with reference counter increased by one.public final AsyncModel loadModelAsyncWithCache(ModelReaderSettings settings) throws java.lang.IllegalStateException
settings - ModelReaderSettings to loadAsyncModeljava.lang.IllegalStateException - if models is not setCachepublic final boolean hasAsyncModelLoaded()
AsyncModel has been loaded since last call of this methodpublic final Motion loadMotion(ReaderSettings settings) throws java.io.IOException
#motions if assigned.#loadMotionAsync(ReaderSettings, String) internally.Motion loadedjava.io.IOException - if an exception occurs while loading#loadMotionAsync(ReaderSettings, String)public final AsyncMotion loadMotionAsync(ReaderSettings settings)
Motion loading.settings - ReaderSettings describing the motion to loadidentifier - unique identifier of the motion, used for the key in MotionLibraryAsyncMotion which will load asynchronously the Motion, use AsyncAsset.get()public final AsyncMotion loadMotionAsyncWithCache(ReaderSettings settings) throws java.lang.IllegalStateException
settings - ReaderSettings to loadAsyncMotionjava.lang.IllegalStateException - if motions is not setCachepublic final boolean hasAsyncMotionLoaded()
AsyncMotion has been loaded since last call of this method@Deprecated public final void readAndLoadTextures(IGL gl, Model model)
public final void readTextures(Model model)
ModelreadTexturesAsync(Model)public final void readTexturesAsync()
throws java.lang.IllegalStateException
AssetManagerjava.lang.IllegalStateException - if models is not setpublic final void readTexturesAsync(Model model)
Modelpublic final void readTextureAsync(Texture texture, TextureParam textureParam)
public final void onLoad(Texture texture)
onLoad in interface OnLoadListener<Texture>public final void destroy(IGL gl)
#destroy(IGLApi, boolean)public final void destroy(IGL gl, boolean force)
force set to true,
if false equivalent to #destroy(IGLApi)#destroy(IGLApi)public final void onContextLost()
public final void onContextLost(Model model)
onContextLost()model - discard renderer data. Also, if automatic asynchronous loading is used, according assets (texture and/or shader) will be reloadedonContextLost(),
setReadTextureAsync(boolean),
setShaderGenerator(ShaderGenerator)public final Finder getTextureFinder()
public final Finder getShaderFinder()
public final void loadShaders()
public final void loadShaders(Model model)
public final void generateShadersAsync(Model model) throws java.lang.IllegalStateException
Model.setShaderGenerator(ShaderGenerator) to be set.model - Model to generate shader tojava.lang.IllegalStateExceptionsetShaderGenerator(ShaderGenerator)public final void onMaterialChanged(Model model, MaterialStandard material)
MaterialStandard has a shader changedBonzai Engine 1.3.4 11/12/2015 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2015 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com