use of com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData in project libgdx by libgdx.
the class ParticleControllerInfluencer method load.
@Override
public void load(AssetManager manager, ResourceData resources) {
SaveData data = resources.getSaveData();
Array<IntArray> effectsIndices = data.load("indices");
AssetDescriptor descriptor;
Iterator<IntArray> iterator = effectsIndices.iterator();
while ((descriptor = data.loadAsset()) != null) {
ParticleEffect effect = (ParticleEffect) manager.get(descriptor);
if (effect == null)
throw new RuntimeException("Template is null");
Array<ParticleController> effectControllers = effect.getControllers();
IntArray effectIndices = iterator.next();
for (int i = 0, n = effectIndices.size; i < n; i++) {
templates.add(effectControllers.get(effectIndices.get(i)));
}
}
}
use of com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData in project libgdx by libgdx.
the class ParticleControllerInfluencer method save.
@Override
public void save(AssetManager manager, ResourceData resources) {
SaveData data = resources.createSaveData();
Array<ParticleEffect> effects = manager.getAll(ParticleEffect.class, new Array<ParticleEffect>());
Array<ParticleController> controllers = new Array<ParticleController>(templates);
Array<IntArray> effectsIndices = new Array<IntArray>();
for (int i = 0; i < effects.size && controllers.size > 0; ++i) {
ParticleEffect effect = effects.get(i);
Array<ParticleController> effectControllers = effect.getControllers();
Iterator<ParticleController> iterator = controllers.iterator();
IntArray indices = null;
while (iterator.hasNext()) {
ParticleController controller = iterator.next();
int index = -1;
if ((index = effectControllers.indexOf(controller, true)) > -1) {
if (indices == null) {
indices = new IntArray();
}
iterator.remove();
indices.add(index);
}
}
if (indices != null) {
data.saveAsset(manager.getAssetFileName(effect), ParticleEffect.class);
effectsIndices.add(indices);
}
}
data.save("indices", effectsIndices);
}
use of com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData in project libgdx by libgdx.
the class MeshSpawnShapeValue method load.
@Override
public void load(AssetManager manager, ResourceData data) {
SaveData saveData = data.getSaveData();
AssetDescriptor descriptor = saveData.loadAsset();
if (descriptor != null) {
Model model = (Model) manager.get(descriptor);
setMesh(model.meshes.get((Integer) saveData.load("index")), model);
}
}
use of com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData in project libgdx by libgdx.
the class BillboardParticleBatch method load.
@Override
public void load(AssetManager manager, ResourceData resources) {
SaveData data = resources.getSaveData("billboardBatch");
if (data != null) {
setTexture((Texture) manager.get(data.loadAsset()));
Config cfg = (Config) data.load("cfg");
setUseGpu(cfg.useGPU);
setAlignMode(cfg.mode);
}
}
use of com.badlogic.gdx.graphics.g3d.particles.ResourceData.SaveData in project libgdx by libgdx.
the class ModelInfluencer method load.
@Override
public void load(AssetManager manager, ResourceData resources) {
SaveData data = resources.getSaveData();
AssetDescriptor descriptor;
while ((descriptor = data.loadAsset()) != null) {
Model model = (Model) manager.get(descriptor);
if (model == null)
throw new RuntimeException("Model is null");
models.add(model);
}
}
Aggregations