use of com.talosvfx.talos.runtime.utils.VectorField in project talos by rockbite.
the class VectorFieldModuleWrapper method fileDrop.
@Override
public void fileDrop(String[] paths, float x, float y) {
if (paths.length > 0) {
String path = paths[0];
FileHandle handle = Gdx.files.absolute(path);
VectorField vectorField = new VectorField();
vectorField.setBakedData(handle);
TalosAssetProvider assetProvider = TalosMain.Instance().TalosProject().getProjectAssetProvider();
assetProvider.addVectorField(handle.nameWithoutExtension(), vectorField);
setVectorField(vectorField, handle.nameWithoutExtension());
TalosMain.Instance().FileTracker().trackFile(handle, new FileTracker.Tracker() {
@Override
public void updated(FileHandle handle) {
VectorField vectorField = new VectorField();
vectorField.setBakedData(handle);
TalosAssetProvider assetProvider = TalosMain.Instance().TalosProject().getProjectAssetProvider();
assetProvider.addVectorField(handle.nameWithoutExtension(), vectorField);
setVectorField(vectorField, handle.nameWithoutExtension());
}
});
}
}
use of com.talosvfx.talos.runtime.utils.VectorField in project talos by rockbite.
the class TalosAssetProvider method findVectorOrLoad.
private VectorField findVectorOrLoad(String assetName) {
VectorField vectorField = vectorFields.get(assetName);
if (vectorField == null) {
// Look in all paths, and hopefully load the requested asset, or fail (crash)
final FileHandle file = findFile(assetName);
vectorField = new VectorField();
if (file != null && file.exists()) {
vectorField.setBakedData(file);
}
}
return vectorField;
}
use of com.talosvfx.talos.runtime.utils.VectorField in project talos by rockbite.
the class TalosAssetProvider method registerUnknownHandlerParsers.
private void registerUnknownHandlerParsers() {
extensionToAssetParser.put("png", handle -> {
handle = TalosMain.Instance().ProjectController().findFile(handle);
if (handle == null)
return;
addToAtlas(handle.nameWithoutExtension(), new TextureRegion(new Texture(handle)));
});
extensionToAssetParser.put("jpg", handle -> {
handle = TalosMain.Instance().ProjectController().findFile(handle);
if (handle == null)
return;
addToAtlas(handle.nameWithoutExtension(), new TextureRegion(new Texture(handle)));
});
extensionToAssetParser.put("fga", handle -> {
handle = TalosMain.Instance().ProjectController().findFile(handle);
if (handle == null)
return;
addVectorField(handle.nameWithoutExtension(), new VectorField(handle));
});
extensionToAssetParser.put("shdr", handle -> {
handle = TalosMain.Instance().ProjectController().findFile(handle);
if (handle == null)
return;
addShaderDescriptor(handle.nameWithoutExtension(), new ShaderDescriptor(handle));
});
}
Aggregations