add android integration & make iOS API consistent

add pubspec android plugin

update android CMakeLists

add filament android libs for linking
This commit is contained in:
Nick Fisher
2022-02-06 13:45:45 +08:00
parent 5c40b24b14
commit 9c0c73146b
38 changed files with 1046 additions and 6646 deletions

View File

@@ -4,7 +4,6 @@ import 'package:flutter/services.dart';
abstract class FilamentController {
void onFilamentViewCreated(int id);
Future loadSkybox(String skyboxPath, String lightingPath);
Future loadGlb(String path);
Future loadGltf(String path, String relativeResourcePath);
@@ -43,23 +42,15 @@ class PolyvoxFilamentController extends FilamentController {
_id = id;
_channel = MethodChannel("app.polyvox.filament/filament_view_$id");
_channel.setMethodCallHandler((call) async {
await Future.delayed(const Duration(
seconds:
1)); // todo - need a better way to know when the GL context is actually ready
await _initialize();
onFilamentViewCreatedHandler?.call(_id);
return Future.value(true);
if(call.method == "ready") {
onFilamentViewCreatedHandler?.call(_id);
return Future.value(true);
} else {
throw Exception("Unknown method channel invocation ${call.method}");
}
});
}
Future _initialize() async {
await _channel.invokeMethod("initialize", [
"packages/polyvox_filament/assets/lit_opaque.filamat",
"packages/polyvox_filament/assets/lit_fade.filamat"
]);
}
@override
Future loadSkybox(String skyboxPath, String lightingPath) async {
await _channel.invokeMethod("loadSkybox", [skyboxPath, lightingPath]);