public class AssetManager extends java.lang.Object implements OnLoadListener<Texture>, IDestroyable
| Modifier and Type | Field and Description |
|---|---|
protected static int |
ANIM_PRIORITY |
AnimGraphLibrary |
animGraphs
AnimGraph library
|
java.lang.ClassLoader |
context
ClassLoader which may be used by asynchronous loading task to resolve resources |
MaterialLibrary |
materials
Material library
|
protected static int |
MODEL_PRIORITY |
ModelLibrary |
models
Model library
|
MotionLibrary |
motions
Motion library
|
ShaderList |
shaders
Optional: List of shaders
|
SplineLibrary |
splines
Spline library
|
protected static int |
TEXTURE_DIFFUSE_PRIORITY |
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(IGLApi glApi)
Destroy AsyncModel/Texture/Shader with a reference count of 0,
and all AsyncMotion, MaterialAdvanced
|
void |
destroy(IGLApi glApi,
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. |
boolean |
hasAsyncModelLoaded() |
boolean |
hasAsyncMotionLoaded() |
boolean |
isWorking() |
AsyncModel |
loadModel(ModelReaderSettings settings)
Deprecated.
use
ModelLibrary.use(AssetManager, ModelReaderSettings), or to bypass ModelLibrary use the AsyncModel constructor directly. |
Model |
loadModelSync(ModelReaderSettings settings)
Deprecated.
|
AsyncModel |
loadModelWithCache(ModelReaderSettings settings)
Load model asynchronously using download cache
|
AsyncMotion |
loadMotion(ReaderSettings settings)
Asynchronous
Motion loading. |
AsyncMotion |
loadMotionWithCache(ReaderSettings settings)
Load motion asynchronously using download cache
|
void |
onContextLost()
The be called when the OpenGL context has been lost
|
void |
onContextLost(Model model)
Must be called after
onContextLost() |
protected void |
onLoad(Model model) |
protected void |
onLoad(Motion motion) |
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 |
readTexture(Texture texture,
TextureParam textureParam) |
void |
readTextures(Model model)
Asynchronous read all textures of the specified
Model |
void |
setShaderGenerator(ShaderGenerator shaderGenerator)
Automatically queue asynchronous shader generation when a
Texture has been loaded |
protected static final int MODEL_PRIORITY
protected static final int ANIM_PRIORITY
protected static final int TEXTURE_DIFFUSE_PRIORITY
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 setShaderGenerator(ShaderGenerator shaderGenerator)
Texture has been loadedjava.lang.IllegalStateException - if textures is not set@Deprecated public final Model loadModelSync(ModelReaderSettings settings) throws java.io.IOException
loadModel(ModelReaderSettings)AsyncModel asyncModel = assets.loadModelAsync(settings); Model model = asyncModel.getSync(); asyncModel.release(); return model;
settings - java.io.IOException - if an exception occurs while loadingloadModel(ModelReaderSettings)public final AsyncModel loadModel(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 loadModelWithCache(ModelReaderSettings settings) throws java.lang.IllegalStateException
settings - ModelReaderSettings to loadAsyncModeljava.lang.IllegalStateException - if models is not setCacheprotected final void onLoad(Model model)
public final boolean hasAsyncModelLoaded()
AsyncModel has been loaded since last call of this methodpublic final AsyncMotion loadMotion(ReaderSettings settings)
Motion loading.settings - ReaderSettings describing the motion to loadAsyncMotion which will load asynchronously the Motion, use AsyncAsset.get()public final AsyncMotion loadMotionWithCache(ReaderSettings settings) throws java.lang.IllegalStateException
settings - ReaderSettings to loadAsyncMotionjava.lang.IllegalStateException - if motions is not setCacheprotected final void onLoad(Motion motion)
public final boolean hasAsyncMotionLoaded()
AsyncMotion has been loaded since last call of this methodpublic final void readTextures(Model model)
Modelpublic final void readTexture(Texture texture, TextureParam textureParam)
public final void onLoad(Texture texture)
onLoad in interface OnLoadListener<Texture>public final void destroy(IGLApi glApi)
destroy in interface IDestroyabledestroy(IGLApi, boolean)public final void destroy(IGLApi glApi, 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 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.4.1-20200831 - A Java OpenGL engine and tools for Windows/Mac/Linux/Android
Copyright © 2007-2019 Jérôme Jouvie bonzaiengine.com contact@bonzaiengine.com