add clamp option to android bindings and allow resource paths starting with file://
This commit is contained in:
@@ -85,7 +85,7 @@ interface FilamentInterop : Library {
|
||||
fun clear_lights(viewer:Pointer);
|
||||
|
||||
fun set_background_image(viewer:Pointer, path:String);
|
||||
fun set_background_image_position(viewer:Pointer, x:Float, y:Float);
|
||||
fun set_background_image_position(viewer:Pointer, x:Float, y:Float, clamp:Boolean);
|
||||
|
||||
fun load_texture(asset:Pointer, path:String, renderableIndex:Int);
|
||||
fun set_texture(asset:Pointer);
|
||||
|
||||
@@ -156,6 +156,10 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware {
|
||||
}
|
||||
|
||||
fun getAssetPath(path:String) : String {
|
||||
if(path.startsWith("file://")) {
|
||||
return path
|
||||
}
|
||||
|
||||
val loader = FlutterInjector.instance().flutterLoader()
|
||||
val key = loader.getLookupKeyForAsset(path)
|
||||
val hotReloadPath = HotReloadPathHelper.getAssetPath(key, activity.getPackageName())
|
||||
@@ -240,7 +244,7 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware {
|
||||
"setBackgroundImagePosition" -> {
|
||||
executor.execute {
|
||||
val args = call.arguments as ArrayList<Any?>
|
||||
_lib.set_background_image_position(_viewer!!, (args[0] as Double).toFloat(), (args[1] as Double).toFloat())
|
||||
_lib.set_background_image_position(_viewer!!, (args[0] as Double).toFloat(), (args[1] as Double).toFloat(), (args[2] as Boolean))
|
||||
result.success("OK");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user