more FFI work

This commit is contained in:
Nick Fisher
2023-09-29 17:58:12 +08:00
parent dd88c45536
commit e8ba136863
17 changed files with 927 additions and 414 deletions

View File

@@ -48,7 +48,7 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
_lib.set_rendering_ffi(_viewer!, render ? 1 : 0);
_lib.set_rendering_ffi(_viewer!, render);
}
Future render() async {
@@ -59,7 +59,7 @@ class FilamentControllerFFI extends FilamentController {
}
Future setFrameRate(int framerate) async {
await _channel.invokeMethod("setFrameInterval", 1.0 / framerate);
_lib.set_frame_interval_ffi(1.0 / framerate);
}
void setPixelRatio(double ratio) {
@@ -107,7 +107,9 @@ class FilamentControllerFFI extends FilamentController {
await _channel.invokeMethod("createTexture", [size.width, size.height]);
var flutterTextureId = textures[0];
_textureId = flutterTextureId;
var pixelBuffer = textures[1] as int;
var surfaceAddress = textures[1] as int? ?? 0;
// void* on iOS/MacOS, GLuid on Android/Windows/Linux
var nativeTexture = textures[2] as int;
var renderCallbackResult = await _channel.invokeMethod("getRenderCallback");
@@ -127,9 +129,11 @@ class FilamentControllerFFI extends FilamentController {
renderCallbackOwner);
_lib.create_swap_chain(
_viewer!, Pointer<Void>.fromAddress(pixelBuffer), width, height);
_lib.create_render_target(_viewer!, nativeTexture, width, height);
_viewer!, Pointer<Void>.fromAddress(surfaceAddress), width, height);
if (nativeTexture != 0) {
assert(surfaceAddress == 0);
_lib.create_render_target(_viewer!, nativeTexture, width, height);
}
_lib.update_viewport_and_camera_projection_ffi(
_viewer!, width, height, 1.0);
@@ -162,7 +166,7 @@ class FilamentControllerFFI extends FilamentController {
throw Exception("No viewer available, ignoring");
}
_lib.set_background_image_ffi(
_viewer!, path.toNativeUtf8().cast<Char>(), fillHeight ? 1 : 0);
_viewer!, path.toNativeUtf8().cast<Char>(), fillHeight);
}
Future setBackgroundColor(Color color) async {
@@ -182,7 +186,7 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
_lib.set_background_image_position_ffi(_viewer!, x, y, clamp ? 1 : 0);
_lib.set_background_image_position_ffi(_viewer!, x, y, clamp);
}
Future loadSkybox(String skyboxPath) async {
@@ -229,7 +233,7 @@ class FilamentControllerFFI extends FilamentController {
throw Exception("No viewer available, ignoring");
}
var entity = _lib.add_light_ffi(_viewer!, type, colour, intensity, posX,
posY, posZ, dirX, dirY, dirZ, castShadows ? 1 : 0);
posY, posZ, dirX, dirY, dirZ, castShadows);
return entity;
}
@@ -255,7 +259,7 @@ class FilamentControllerFFI extends FilamentController {
throw Exception("Not yet implemented");
}
var asset = _lib.load_glb_ffi(
_assetManager!, path.toNativeUtf8().cast<Char>(), unlit ? 1 : 0);
_assetManager!, path.toNativeUtf8().cast<Char>(), unlit);
if (asset == FILAMENT_ASSET_ERROR) {
throw Exception("An error occurred loading the asset at $path");
}
@@ -278,7 +282,7 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, 1);
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, true);
}
Future panUpdate(double x, double y) async {
@@ -299,7 +303,7 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, 0);
_lib.grab_begin(_viewer!, x * _pixelRatio, y * _pixelRatio, false);
}
Future rotateUpdate(double x, double y) async {
@@ -372,9 +376,10 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
var duration = await _channel.invokeMethod(
"getAnimationDuration", [_assetManager!, asset, animationIndex]);
return duration as double;
var duration =
_lib.get_animation_duration_ffi(_assetManager!, asset, animationIndex);
return duration;
}
///
@@ -470,7 +475,7 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
await _channel.invokeMethod("scrollBegin");
_lib.scroll_begin(_viewer!);
}
Future zoomUpdate(double z) async {
@@ -495,8 +500,8 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
_lib.play_animation_ffi(_assetManager!, asset, index, loop ? 1 : 0,
reverse ? 1 : 0, replaceActive ? 1 : 0, crossfade);
_lib.play_animation_ffi(
_assetManager!, asset, index, loop, reverse, replaceActive, crossfade);
}
Future setAnimationFrame(
@@ -504,23 +509,23 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
await _channel.invokeMethod(
"setAnimationFrame", [_assetManager!, asset, index, animationFrame]);
_lib.set_animation_frame(_assetManager!, asset, index, animationFrame);
}
Future stopAnimation(FilamentEntity asset, int animationIndex) async {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
await _channel
.invokeMethod("stopAnimation", [_assetManager!, asset, animationIndex]);
_lib.stop_animation(_assetManager!, asset, animationIndex);
}
Future setCamera(FilamentEntity asset, String? name) async {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
if (await _channel.invokeMethod("setCamera", [asset, name]) != true) {
var result = _lib.set_camera(
_viewer!, asset, name?.toNativeUtf8()?.cast<Char>() ?? nullptr);
if (result != 1) {
throw Exception("Failed to set camera");
}
}
@@ -572,7 +577,7 @@ class FilamentControllerFFI extends FilamentController {
if (_viewer == null || _resizing) {
throw Exception("No viewer available, ignoring");
}
_lib.set_view_frustum_culling(_viewer!, enabled ? 1 : 0);
_lib.set_view_frustum_culling(_viewer!, enabled);
}
Future setCameraExposure(

View File

@@ -71,39 +71,39 @@ class _FilamentWidgetState extends State<FilamentWidget> {
Timer? _resizeTimer;
void _handleStateChange(AppLifecycleState state) async {
switch (state) {
case AppLifecycleState.detached:
print("Detached");
_textureId = null;
// switch (state) {
// case AppLifecycleState.detached:
// print("Detached");
// _textureId = null;
await widget.controller.destroyViewer();
await widget.controller.destroyTexture();
break;
case AppLifecycleState.hidden:
print("Hidden");
if (Platform.isIOS) {
_textureId = null;
await widget.controller.destroyViewer();
await widget.controller.destroyTexture();
}
break;
case AppLifecycleState.inactive:
print("Inactive");
break;
case AppLifecycleState.paused:
print("Paused");
break;
case AppLifecycleState.resumed:
print("Resumed");
if (_textureId == null) {
var size = ((context.findRenderObject()) as RenderBox).size;
print("Size after resuming : $size");
await widget.controller
.createViewer(size.width.toInt(), size.height.toInt());
print("Created viewer Size after resuming");
}
break;
}
// await widget.controller.destroyViewer();
// await widget.controller.destroyTexture();
// break;
// case AppLifecycleState.hidden:
// print("Hidden");
// if (Platform.isIOS) {
// _textureId = null;
// await widget.controller.destroyViewer();
// await widget.controller.destroyTexture();
// }
// break;
// case AppLifecycleState.inactive:
// print("Inactive");
// break;
// case AppLifecycleState.paused:
// print("Paused");
// break;
// case AppLifecycleState.resumed:
// print("Resumed");
// if (_textureId == null) {
// var size = ((context.findRenderObject()) as RenderBox).size;
// print("Size after resuming : $size");
// await widget.controller
// .createViewer(size.width.toInt(), size.height.toInt());
// print("Created viewer Size after resuming");
// }
// break;
// }
_lastState = state;
}

View File

@@ -90,13 +90,13 @@ class NativeLibrary {
void create_render_target(
ffi.Pointer<ffi.Void> viewer,
int textureId,
int texture,
int width,
int height,
) {
return _create_render_target(
viewer,
textureId,
texture,
width,
height,
);
@@ -104,7 +104,7 @@ class NativeLibrary {
late final _create_render_targetPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Uint32, ffi.Uint32,
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.IntPtr, ffi.Uint32,
ffi.Uint32)>>('create_render_target');
late final _create_render_target = _create_render_targetPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, int, int, int)>();
@@ -126,7 +126,7 @@ class NativeLibrary {
void set_background_image(
ffi.Pointer<ffi.Void> viewer,
ffi.Pointer<ffi.Char> path,
int fillHeight,
bool fillHeight,
) {
return _set_background_image(
viewer,
@@ -138,15 +138,15 @@ class NativeLibrary {
late final _set_background_imagePtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
ffi.Int)>>('set_background_image');
ffi.Bool)>>('set_background_image');
late final _set_background_image = _set_background_imagePtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, int)>();
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, bool)>();
void set_background_image_position(
ffi.Pointer<ffi.Void> viewer,
double x,
double y,
int clamp,
bool clamp,
) {
return _set_background_image_position(
viewer,
@@ -159,9 +159,9 @@ class NativeLibrary {
late final _set_background_image_positionPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float,
ffi.Int)>>('set_background_image_position');
ffi.Bool)>>('set_background_image_position');
late final _set_background_image_position = _set_background_image_positionPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, double, double, int)>();
.asFunction<void Function(ffi.Pointer<ffi.Void>, double, double, bool)>();
void set_background_color(
ffi.Pointer<ffi.Void> viewer,
@@ -295,7 +295,7 @@ class NativeLibrary {
double dirX,
double dirY,
double dirZ,
int shadows,
bool shadows,
) {
return _add_light(
viewer,
@@ -325,10 +325,10 @@ class NativeLibrary {
ffi.Float,
ffi.Float,
ffi.Float,
ffi.Int)>>('add_light');
ffi.Bool)>>('add_light');
late final _add_light = _add_lightPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, double, double, double, double,
double, double, double, double, int)>();
double, double, double, double, bool)>();
void remove_light(
ffi.Pointer<ffi.Void> viewer,
@@ -364,7 +364,7 @@ class NativeLibrary {
int load_glb(
ffi.Pointer<ffi.Void> assetManager,
ffi.Pointer<ffi.Char> assetPath,
int unlit,
bool unlit,
) {
return _load_glb(
assetManager,
@@ -376,9 +376,9 @@ class NativeLibrary {
late final _load_glbPtr = _lookup<
ffi.NativeFunction<
EntityId Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
ffi.Int)>>('load_glb');
ffi.Bool)>>('load_glb');
late final _load_glb = _load_glbPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, int)>();
int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, bool)>();
int load_gltf(
ffi.Pointer<ffi.Void> assetManager,
@@ -400,7 +400,7 @@ class NativeLibrary {
int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Char>)>();
int set_camera(
bool set_camera(
ffi.Pointer<ffi.Void> viewer,
int asset,
ffi.Pointer<ffi.Char> nodeName,
@@ -414,14 +414,14 @@ class NativeLibrary {
late final _set_cameraPtr = _lookup<
ffi.NativeFunction<
ffi.Int Function(ffi.Pointer<ffi.Void>, EntityId,
ffi.Bool Function(ffi.Pointer<ffi.Void>, EntityId,
ffi.Pointer<ffi.Char>)>>('set_camera');
late final _set_camera = _set_cameraPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
bool Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
void set_view_frustum_culling(
ffi.Pointer<ffi.Void> viewer,
int enabled,
bool enabled,
) {
return _set_view_frustum_culling(
viewer,
@@ -431,10 +431,10 @@ class NativeLibrary {
late final _set_view_frustum_cullingPtr = _lookup<
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>>(
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
'set_view_frustum_culling');
late final _set_view_frustum_culling = _set_view_frustum_cullingPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, int)>();
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
void render(
ffi.Pointer<ffi.Void> viewer,
@@ -579,7 +579,7 @@ class NativeLibrary {
ffi.Pointer<ffi.Void> viewer,
double x,
double y,
int pan,
bool pan,
) {
return _grab_begin(
viewer,
@@ -592,9 +592,9 @@ class NativeLibrary {
late final _grab_beginPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float,
ffi.Int)>>('grab_begin');
ffi.Bool)>>('grab_begin');
late final _grab_begin = _grab_beginPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, double, double, int)>();
.asFunction<void Function(ffi.Pointer<ffi.Void>, double, double, bool)>();
void grab_update(
ffi.Pointer<ffi.Void> viewer,
@@ -686,7 +686,7 @@ class NativeLibrary {
void Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Float>, int)>();
int set_morph_animation(
bool set_morph_animation(
ffi.Pointer<ffi.Void> assetManager,
int asset,
ffi.Pointer<ffi.Char> entityName,
@@ -710,7 +710,7 @@ class NativeLibrary {
late final _set_morph_animationPtr = _lookup<
ffi.NativeFunction<
ffi.Int Function(
ffi.Bool Function(
ffi.Pointer<ffi.Void>,
EntityId,
ffi.Pointer<ffi.Char>,
@@ -720,7 +720,7 @@ class NativeLibrary {
ffi.Int,
ffi.Float)>>('set_morph_animation');
late final _set_morph_animation = _set_morph_animationPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>,
bool Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Float>, ffi.Pointer<ffi.Int>, int, int, double)>();
void set_bone_animation(
@@ -775,9 +775,9 @@ class NativeLibrary {
ffi.Pointer<ffi.Void> assetManager,
int asset,
int index,
int loop,
int reverse,
int replaceActive,
bool loop,
bool reverse,
bool replaceActive,
double crossfade,
) {
return _play_animation(
@@ -793,10 +793,11 @@ class NativeLibrary {
late final _play_animationPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Int, ffi.Int,
ffi.Int, ffi.Int, ffi.Float)>>('play_animation');
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Int, ffi.Bool,
ffi.Bool, ffi.Bool, ffi.Float)>>('play_animation');
late final _play_animation = _play_animationPtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, int, int, int, int, int, double)>();
void Function(
ffi.Pointer<ffi.Void>, int, int, bool, bool, bool, double)>();
void set_animation_frame(
ffi.Pointer<ffi.Void> assetManager,
@@ -974,7 +975,7 @@ class NativeLibrary {
late final _clear_assets =
_clear_assetsPtr.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
int set_material_color(
bool set_material_color(
ffi.Pointer<ffi.Void> assetManager,
int asset,
ffi.Pointer<ffi.Char> meshName,
@@ -998,7 +999,7 @@ class NativeLibrary {
late final _set_material_colorPtr = _lookup<
ffi.NativeFunction<
ffi.Int Function(
ffi.Bool Function(
ffi.Pointer<ffi.Void>,
EntityId,
ffi.Pointer<ffi.Char>,
@@ -1008,7 +1009,7 @@ class NativeLibrary {
ffi.Float,
ffi.Float)>>('set_material_color');
late final _set_material_color = _set_material_colorPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>, int,
bool Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>, int,
double, double, double, double)>();
void transform_to_unit_cube(
@@ -1385,7 +1386,7 @@ class NativeLibrary {
void set_rendering_ffi(
ffi.Pointer<ffi.Void> viewer,
int rendering,
bool rendering,
) {
return _set_rendering_ffi(
viewer,
@@ -1395,10 +1396,10 @@ class NativeLibrary {
late final _set_rendering_ffiPtr = _lookup<
ffi
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Int)>>(
.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Bool)>>(
'set_rendering_ffi');
late final _set_rendering_ffi = _set_rendering_ffiPtr
.asFunction<void Function(ffi.Pointer<ffi.Void>, int)>();
.asFunction<void Function(ffi.Pointer<ffi.Void>, bool)>();
void set_frame_interval_ffi(
double frameInterval,
@@ -1478,7 +1479,7 @@ class NativeLibrary {
void set_background_image_ffi(
ffi.Pointer<ffi.Void> viewer,
ffi.Pointer<ffi.Char> path,
int fillHeight,
bool fillHeight,
) {
return _set_background_image_ffi(
viewer,
@@ -1490,16 +1491,16 @@ class NativeLibrary {
late final _set_background_image_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
ffi.Int)>>('set_background_image_ffi');
ffi.Bool)>>('set_background_image_ffi');
late final _set_background_image_ffi =
_set_background_image_ffiPtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, int)>();
void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, bool)>();
void set_background_image_position_ffi(
ffi.Pointer<ffi.Void> viewer,
double x,
double y,
int clamp,
bool clamp,
) {
return _set_background_image_position_ffi(
viewer,
@@ -1512,10 +1513,10 @@ class NativeLibrary {
late final _set_background_image_position_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Float, ffi.Float,
ffi.Int)>>('set_background_image_position_ffi');
ffi.Bool)>>('set_background_image_position_ffi');
late final _set_background_image_position_ffi =
_set_background_image_position_ffiPtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, double, double, int)>();
void Function(ffi.Pointer<ffi.Void>, double, double, bool)>();
void set_tone_mapping_ffi(
ffi.Pointer<ffi.Void> viewer,
@@ -1626,7 +1627,7 @@ class NativeLibrary {
double dirX,
double dirY,
double dirZ,
int shadows,
bool shadows,
) {
return _add_light_ffi(
viewer,
@@ -1656,10 +1657,10 @@ class NativeLibrary {
ffi.Float,
ffi.Float,
ffi.Float,
ffi.Int)>>('add_light_ffi');
ffi.Bool)>>('add_light_ffi');
late final _add_light_ffi = _add_light_ffiPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, double, double, double, double,
double, double, double, double, int)>();
double, double, double, double, bool)>();
void remove_light_ffi(
ffi.Pointer<ffi.Void> viewer,
@@ -1695,7 +1696,7 @@ class NativeLibrary {
int load_glb_ffi(
ffi.Pointer<ffi.Void> assetManager,
ffi.Pointer<ffi.Char> assetPath,
int unlit,
bool unlit,
) {
return _load_glb_ffi(
assetManager,
@@ -1707,9 +1708,9 @@ class NativeLibrary {
late final _load_glb_ffiPtr = _lookup<
ffi.NativeFunction<
EntityId Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>,
ffi.Int)>>('load_glb_ffi');
ffi.Bool)>>('load_glb_ffi');
late final _load_glb_ffi = _load_glb_ffiPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, int)>();
int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, bool)>();
int load_gltf_ffi(
ffi.Pointer<ffi.Void> assetManager,
@@ -1762,7 +1763,7 @@ class NativeLibrary {
late final _clear_assets_ffi =
_clear_assets_ffiPtr.asFunction<void Function(ffi.Pointer<ffi.Void>)>();
int set_camera_ffi(
bool set_camera_ffi(
ffi.Pointer<ffi.Void> viewer,
int asset,
ffi.Pointer<ffi.Char> nodeName,
@@ -1776,10 +1777,10 @@ class NativeLibrary {
late final _set_camera_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Int Function(ffi.Pointer<ffi.Void>, EntityId,
ffi.Bool Function(ffi.Pointer<ffi.Void>, EntityId,
ffi.Pointer<ffi.Char>)>>('set_camera_ffi');
late final _set_camera_ffi = _set_camera_ffiPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
bool Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
void apply_weights_ffi(
ffi.Pointer<ffi.Void> assetManager,
@@ -1838,7 +1839,7 @@ class NativeLibrary {
void Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Float>, int)>();
int set_morph_animation_ffi(
bool set_morph_animation_ffi(
ffi.Pointer<ffi.Void> assetManager,
int asset,
ffi.Pointer<ffi.Char> entityName,
@@ -1862,7 +1863,7 @@ class NativeLibrary {
late final _set_morph_animation_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Int Function(
ffi.Bool Function(
ffi.Pointer<ffi.Void>,
EntityId,
ffi.Pointer<ffi.Char>,
@@ -1872,7 +1873,7 @@ class NativeLibrary {
ffi.Int,
ffi.Float)>>('set_morph_animation_ffi');
late final _set_morph_animation_ffi = _set_morph_animation_ffiPtr.asFunction<
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>,
bool Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>,
ffi.Pointer<ffi.Float>, ffi.Pointer<ffi.Int>, int, int, double)>();
void set_bone_animation_ffi(
@@ -1927,9 +1928,9 @@ class NativeLibrary {
ffi.Pointer<ffi.Void> assetManager,
int asset,
int index,
int loop,
int reverse,
int replaceActive,
bool loop,
bool reverse,
bool replaceActive,
double crossfade,
) {
return _play_animation_ffi(
@@ -1945,10 +1946,11 @@ class NativeLibrary {
late final _play_animation_ffiPtr = _lookup<
ffi.NativeFunction<
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Int, ffi.Int,
ffi.Int, ffi.Int, ffi.Float)>>('play_animation_ffi');
ffi.Void Function(ffi.Pointer<ffi.Void>, EntityId, ffi.Int, ffi.Bool,
ffi.Bool, ffi.Bool, ffi.Float)>>('play_animation_ffi');
late final _play_animation_ffi = _play_animation_ffiPtr.asFunction<
void Function(ffi.Pointer<ffi.Void>, int, int, int, int, int, double)>();
void Function(
ffi.Pointer<ffi.Void>, int, int, bool, bool, bool, double)>();
void set_animation_frame_ffi(
ffi.Pointer<ffi.Void> assetManager,
@@ -2097,10 +2099,102 @@ class NativeLibrary {
int Function(ffi.Pointer<ffi.Void>, int, ffi.Pointer<ffi.Char>)>();
}
final class __mbstate_t extends ffi.Union {
@ffi.Array.multi([128])
external ffi.Array<ffi.Char> __mbstate8;
@ffi.LongLong()
external int _mbstateL;
}
final class __darwin_pthread_handler_rec extends ffi.Struct {
external ffi
.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>
__routine;
external ffi.Pointer<ffi.Void> __arg;
external ffi.Pointer<__darwin_pthread_handler_rec> __next;
}
final class _opaque_pthread_attr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([56])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_cond_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([40])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_condattr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([8])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_mutex_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([56])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_mutexattr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([8])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_once_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([8])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_rwlock_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([192])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_rwlockattr_t extends ffi.Struct {
@ffi.Long()
external int __sig;
@ffi.Array.multi([16])
external ffi.Array<ffi.Char> __opaque;
}
final class _opaque_pthread_t extends ffi.Struct {
@ffi.Long()
external int __sig;
external ffi.Pointer<__darwin_pthread_handler_rec> __cleanup_stack;
@ffi.Array.multi([8176])
external ffi.Array<ffi.Char> __opaque;
}
final class ResourceBuffer extends ffi.Struct {
external ffi.Pointer<ffi.Void> data;
@ffi.Uint32()
@ffi.Int64()
external int size;
@ffi.Uint32()
@@ -2131,128 +2225,174 @@ typedef FreeFilamentResourceFromOwner = ffi.Pointer<
.NativeFunction<ffi.Void Function(ResourceBuffer, ffi.Pointer<ffi.Void>)>>;
typedef EntityId = ffi.Int32;
const int INT64_MAX = 9223372036854775807;
const int __WORDSIZE = 64;
const int INT64_MIN = -9223372036854775808;
const int __DARWIN_ONLY_64_BIT_INO_T = 1;
const int UINT64_MAX = -1;
const int __DARWIN_ONLY_UNIX_CONFORMANCE = 1;
const int __INT_LEAST64_MIN = -9223372036854775808;
const int __DARWIN_ONLY_VERS_1050 = 1;
const int __INT_LEAST64_MAX = 9223372036854775807;
const int __DARWIN_UNIX03 = 1;
const int __UINT_LEAST64_MAX = -1;
const int __DARWIN_64_BIT_INO_T = 1;
const int __INT_LEAST32_MIN = -2147483648;
const int __DARWIN_VERS_1050 = 1;
const int __INT_LEAST32_MAX = 2147483647;
const int __DARWIN_NON_CANCELABLE = 0;
const int __UINT_LEAST32_MAX = 4294967295;
const String __DARWIN_SUF_EXTSN = '\$DARWIN_EXTSN';
const int __INT_LEAST16_MIN = -32768;
const int __DARWIN_C_ANSI = 4096;
const int __INT_LEAST16_MAX = 32767;
const int __DARWIN_C_FULL = 900000;
const int __UINT_LEAST16_MAX = 65535;
const int __DARWIN_C_LEVEL = 900000;
const int __INT_LEAST8_MIN = -128;
const int __STDC_WANT_LIB_EXT1__ = 1;
const int __INT_LEAST8_MAX = 127;
const int __DARWIN_NO_LONG_LONG = 0;
const int __UINT_LEAST8_MAX = 255;
const int _DARWIN_FEATURE_64_BIT_INODE = 1;
const int INT_LEAST64_MIN = -9223372036854775808;
const int _DARWIN_FEATURE_ONLY_64_BIT_INODE = 1;
const int INT_LEAST64_MAX = 9223372036854775807;
const int _DARWIN_FEATURE_ONLY_VERS_1050 = 1;
const int UINT_LEAST64_MAX = -1;
const int _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE = 1;
const int INT_FAST64_MIN = -9223372036854775808;
const int _DARWIN_FEATURE_UNIX_CONFORMANCE = 3;
const int INT_FAST64_MAX = 9223372036854775807;
const int __has_ptrcheck = 0;
const int UINT_FAST64_MAX = -1;
const int __DARWIN_NULL = 0;
const int INT32_MAX = 2147483647;
const int __PTHREAD_SIZE__ = 8176;
const int INT32_MIN = -2147483648;
const int __PTHREAD_ATTR_SIZE__ = 56;
const int UINT32_MAX = 4294967295;
const int __PTHREAD_MUTEXATTR_SIZE__ = 8;
const int INT_LEAST32_MIN = -2147483648;
const int __PTHREAD_MUTEX_SIZE__ = 56;
const int INT_LEAST32_MAX = 2147483647;
const int __PTHREAD_CONDATTR_SIZE__ = 8;
const int UINT_LEAST32_MAX = 4294967295;
const int __PTHREAD_COND_SIZE__ = 40;
const int INT_FAST32_MIN = -2147483648;
const int __PTHREAD_ONCE_SIZE__ = 8;
const int INT_FAST32_MAX = 2147483647;
const int __PTHREAD_RWLOCK_SIZE__ = 192;
const int UINT_FAST32_MAX = 4294967295;
const int __PTHREAD_RWLOCKATTR_SIZE__ = 16;
const int INT16_MAX = 32767;
const int INT16_MIN = -32768;
const int UINT16_MAX = 65535;
const int INT_LEAST16_MIN = -32768;
const int INT_LEAST16_MAX = 32767;
const int UINT_LEAST16_MAX = 65535;
const int INT_FAST16_MIN = -32768;
const int INT_FAST16_MAX = 32767;
const int UINT_FAST16_MAX = 65535;
const int USER_ADDR_NULL = 0;
const int INT8_MAX = 127;
const int INT16_MAX = 32767;
const int INT32_MAX = 2147483647;
const int INT64_MAX = 9223372036854775807;
const int INT8_MIN = -128;
const int INT16_MIN = -32768;
const int INT32_MIN = -2147483648;
const int INT64_MIN = -9223372036854775808;
const int UINT8_MAX = 255;
const int UINT16_MAX = 65535;
const int UINT32_MAX = 4294967295;
const int UINT64_MAX = -1;
const int INT_LEAST8_MIN = -128;
const int INT_LEAST16_MIN = -32768;
const int INT_LEAST32_MIN = -2147483648;
const int INT_LEAST64_MIN = -9223372036854775808;
const int INT_LEAST8_MAX = 127;
const int INT_LEAST16_MAX = 32767;
const int INT_LEAST32_MAX = 2147483647;
const int INT_LEAST64_MAX = 9223372036854775807;
const int UINT_LEAST8_MAX = 255;
const int UINT_LEAST16_MAX = 65535;
const int UINT_LEAST32_MAX = 4294967295;
const int UINT_LEAST64_MAX = -1;
const int INT_FAST8_MIN = -128;
const int INT_FAST16_MIN = -32768;
const int INT_FAST32_MIN = -2147483648;
const int INT_FAST64_MIN = -9223372036854775808;
const int INT_FAST8_MAX = 127;
const int INT_FAST16_MAX = 32767;
const int INT_FAST32_MAX = 2147483647;
const int INT_FAST64_MAX = 9223372036854775807;
const int UINT_FAST8_MAX = 255;
const int INTPTR_MIN = -9223372036854775808;
const int UINT_FAST16_MAX = 65535;
const int UINT_FAST32_MAX = 4294967295;
const int UINT_FAST64_MAX = -1;
const int INTPTR_MAX = 9223372036854775807;
const int INTPTR_MIN = -9223372036854775808;
const int UINTPTR_MAX = -1;
const int INTMAX_MAX = 9223372036854775807;
const int UINTMAX_MAX = -1;
const int INTMAX_MIN = -9223372036854775808;
const int PTRDIFF_MIN = -9223372036854775808;
const int PTRDIFF_MAX = 9223372036854775807;
const int SIZE_MAX = -1;
const int INTMAX_MIN = -9223372036854775808;
const int RSIZE_MAX = 9223372036854775807;
const int INTMAX_MAX = 9223372036854775807;
const int WCHAR_MAX = 2147483647;
const int UINTMAX_MAX = -1;
const int SIG_ATOMIC_MIN = -2147483648;
const int SIG_ATOMIC_MAX = 2147483647;
const int WCHAR_MIN = -2147483648;
const int WINT_MIN = -2147483648;
const int WINT_MAX = 2147483647;
const int WCHAR_MAX = 2147483647;
const int SIG_ATOMIC_MIN = -2147483648;
const int WCHAR_MIN = -2147483648;
const int SIG_ATOMIC_MAX = 2147483647;
const int __bool_true_false_are_defined = 1;
const int true1 = 1;
const int false1 = 0;