diff --git a/thermion_dart/lib/src/filament/src/implementation/ffi_filament_app.dart b/thermion_dart/lib/src/filament/src/implementation/ffi_filament_app.dart index 8e976433..d9474c45 100644 --- a/thermion_dart/lib/src/filament/src/implementation/ffi_filament_app.dart +++ b/thermion_dart/lib/src/filament/src/implementation/ffi_filament_app.dart @@ -86,8 +86,9 @@ class FFIFilamentApp extends FilamentApp { config.disableHandleUseAfterFreeCheck, cb)); final nameComponentManager = NameComponentManager_create(); - final gltfAssetLoader = await withPointerCallback( - (cb) => GltfAssetLoader_createRenderThread(engine, nullptr, nameComponentManager, cb)); + final gltfAssetLoader = await withPointerCallback((cb) => + GltfAssetLoader_createRenderThread( + engine, nullptr, nameComponentManager, cb)); final renderer = await withPointerCallback( (cb) => Engine_createRendererRenderThread(engine, cb)); final ubershaderMaterialProvider = @@ -101,8 +102,6 @@ class FFIFilamentApp extends FilamentApp { RenderThread_setRenderTicker(renderTicker); - - FilamentApp.instance = FFIFilamentApp( engine, gltfAssetLoader, @@ -153,6 +152,7 @@ class FFIFilamentApp extends FilamentApp { Future createHeadlessSwapChain(int width, int height, {bool hasStencilBuffer = false}) async { var flags = TSWAP_CHAIN_CONFIG_TRANSPARENT | TSWAP_CHAIN_CONFIG_READABLE; + if (hasStencilBuffer) { flags |= TSWAP_CHAIN_CONFIG_HAS_STENCIL_BUFFER; } @@ -321,7 +321,6 @@ class FFIFilamentApp extends FilamentApp { TextureSamplerType textureSamplerType = TextureSamplerType.SAMPLER_2D, TextureFormat textureFormat = TextureFormat.RGBA16F, int? importedTextureHandle}) async { - var bitmask = flags.fold(0, (a, b) => a | b.value); final texturePtr = await withPointerCallback((cb) { @@ -375,23 +374,19 @@ class FFIFilamentApp extends FilamentApp { } /// Decodes the image data into a native LinearImage (floating point). - /// If [requireAlpha] is true, the decoded image will always contain an - /// alpha channel (even if the original image did not contain one). + /// If [requireAlpha] is true, the decoded image will always contain an + /// alpha channel (even if the original image did not contain one). /// - Future decodeImage(Uint8List data, { String name = "image", bool requireAlpha = false}) async { - + Future decodeImage(Uint8List data, + {String name = "image", bool requireAlpha = false}) async { late Pointer stackPtr; if (FILAMENT_WASM) { //stackPtr = stackSave(); } var now = DateTime.now(); - var ptr = Image_decode( - data.address, - data.length, - name.toNativeUtf8().cast(), - requireAlpha - ); + var ptr = Image_decode(data.address, data.length, + name.toNativeUtf8().cast(), requireAlpha); var finished = DateTime.now(); print( @@ -1211,4 +1206,6 @@ class FFIFilamentApp extends FilamentApp { Vector3(bb.centerX, bb.centerY, bb.centerZ), Vector3(bb.halfExtentX, bb.halfExtentY, bb.halfExtentZ)); } + + }