APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.particles

public Class ParticleEffectLoader

extends AsynchronousAssetLoader<ParticleEffect, ParticleEffectLoader.ParticleEffectLoadParameter>
Class Inheritance
Imports
java.io.IOException, com.badlogic.gdx.Gdx, com.badlogic.gdx.assets.AssetDescriptor, .AssetLoaderParameters, .AssetManager, com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader, .FileHandleResolver, com.badlogic.gdx.files.FileHandle, com.badlogic.gdx.graphics.g3d.particles.ResourceData.AssetData, com.badlogic.gdx.graphics.g3d.particles.batches.ParticleBatch, com.badlogic.gdx.utils.Array, .Json, .JsonWriter, .ObjectMap, com.badlogic.gdx.utils.reflect.ClassReflection

This class can save and load a ParticleEffect. It should be added as AsynchronousAssetLoader to the AssetManager so it will be able to load the effects. It's important to note that the two classes ParticleEffectLoadParameter and ParticleEffectSaveParameter should be passed in whenever possible, because when present the batches settings will be loaded automatically. When the load and save parameters are absent, once the effect will be created, one will have to set the required batches manually otherwise the ParticleController instances contained inside the effect will not be able to render themselves.
Author
inferno

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
protected Array<ObjectMap.Entry<String, ResourceData<ParticleEffect>>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private <T> T
find(Array<?> array, Class<T> type)

public Array<AssetDescriptor<T>>
getDependencies(String fileName, FileHandle file, ParticleEffectLoader.ParticleEffectLoadParameter parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AssetLoader.getDependencies.

Returns the assets this asset requires to be loaded first.

public void
loadAsync(AssetManager manager, String fileName, FileHandle file, ParticleEffectLoader.ParticleEffectLoadParameter parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadAsync.

Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.

public ParticleEffect
loadSync(AssetManager manager, String fileName, FileHandle file, ParticleEffectLoader.ParticleEffectLoadParameter parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadSync.

Loads the OpenGL part of the asset.

public void
save(ParticleEffect effect, ParticleEffectLoader.ParticleEffectSaveParameter parameter)

Saves the effect to the given file contained in the passed in parameter.

Inherited from com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader:
unloadAsync

Field Detail

itemsback to summary
protected Array<ObjectMap.Entry<String, ResourceData<ParticleEffect>>> items

Constructor Detail

ParticleEffectLoaderback to summary
public ParticleEffectLoader(FileHandleResolver resolver)

Method Detail

findback to summary
private <T> T find(Array<?> array, Class<T> type)
getDependenciesback to summary
public Array<AssetDescriptor<T>> getDependencies(String fileName, FileHandle file, ParticleEffectLoader.ParticleEffectLoadParameter parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AssetLoader.getDependencies.

Doc from com.badlogic.gdx.assets.loaders.AssetLoader.getDependencies.

Returns the assets this asset requires to be loaded first. This method may be called on a thread other than the GL thread.

Annotations
@Override
loadAsyncback to summary
public void loadAsync(AssetManager manager, String fileName, FileHandle file, ParticleEffectLoader.ParticleEffectLoadParameter parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadAsync.

Doc from com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadAsync.

Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.

Annotations
@Override
loadSyncback to summary
public ParticleEffect loadSync(AssetManager manager, String fileName, FileHandle file, ParticleEffectLoader.ParticleEffectLoadParameter parameter)

Implements abstract com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadSync.

Doc from com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader.loadSync.

Loads the OpenGL part of the asset.

Annotations
@Override
saveback to summary
public void save(ParticleEffect effect, ParticleEffectLoader.ParticleEffectSaveParameter parameter) throws IOException

Saves the effect to the given file contained in the passed in parameter.

com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParticleEffectLoader.ParticleEffectLoadParameter

extends AssetLoaderParameters<ParticleEffect>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Array<ParticleBatch<?>>
Inherited from com.badlogic.gdx.assets.AssetLoaderParameters:
loadedCallback

Constructor Summary

AccessConstructor and Description
public

Field Detail

batchesback to summary
pack-priv Array<ParticleBatch<?>> batches

Constructor Detail

ParticleEffectLoadParameterback to summary
public ParticleEffectLoadParameter(Array<ParticleBatch<?>> batches)
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParticleEffectLoader.ParticleEffectSaveParameter

extends AssetLoaderParameters<ParticleEffect>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv Array<ParticleBatch<?>>
batches

Optional parameters, but should be present to correctly load the settings

pack-priv FileHandle
file

Required parameters

pack-priv JsonWriter.OutputType
pack-priv AssetManager
pack-priv boolean
Inherited from com.badlogic.gdx.assets.AssetLoaderParameters:
loadedCallback

Constructor Summary

AccessConstructor and Description
public
public
ParticleEffectSaveParameter(FileHandle file, AssetManager manager, Array<ParticleBatch<?>> batches, JsonWriter.OutputType jsonOutputType, boolean prettyPrint)

Field Detail

batchesback to summary
pack-priv Array<ParticleBatch<?>> batches

Optional parameters, but should be present to correctly load the settings

fileback to summary
pack-priv FileHandle file

Required parameters

jsonOutputTypeback to summary
pack-priv JsonWriter.OutputType jsonOutputType
managerback to summary
pack-priv AssetManager manager
prettyPrintback to summary
pack-priv boolean prettyPrint

Constructor Detail

ParticleEffectSaveParameterback to summary
public ParticleEffectSaveParameter(FileHandle file, AssetManager manager, Array<ParticleBatch<?>> batches)
ParticleEffectSaveParameterback to summary
public ParticleEffectSaveParameter(FileHandle file, AssetManager manager, Array<ParticleBatch<?>> batches, JsonWriter.OutputType jsonOutputType, boolean prettyPrint)