From 9ae7c784dfefc51b2b623b7be7cfddca7843d64a Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Thu, 5 Jun 2025 16:41:08 +0800 Subject: [PATCH] pass TFogOptions by value, not pointer, and rearrange struct fields to minimize alignment issues --- .../filament/src/implementation/ffi_view.dart | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/thermion_dart/lib/src/filament/src/implementation/ffi_view.dart b/thermion_dart/lib/src/filament/src/implementation/ffi_view.dart index 82a5fe95..dad01a85 100644 --- a/thermion_dart/lib/src/filament/src/implementation/ffi_view.dart +++ b/thermion_dart/lib/src/filament/src/implementation/ffi_view.dart @@ -224,21 +224,22 @@ class FFIView extends View { @override Future setFogOptions(FogOptions options) async { final tFogOptions = Struct.create(); - tFogOptions.cutOffDistance = options.cutOffDistance; - tFogOptions.enabled = options.enabled; - tFogOptions.density = options.density; + tFogOptions.distance = options.distance; - tFogOptions.fogColorFromIbl = options.fogColorFromIbl; + tFogOptions.cutOffDistance = options.cutOffDistance; + tFogOptions.maximumOpacity = options.maximumOpacity; tFogOptions.height = options.height; tFogOptions.heightFalloff = options.heightFalloff; - tFogOptions.inScatteringSize = options.inScatteringSize; + tFogOptions.density = options.density; tFogOptions.inScatteringStart = options.inScatteringStart; - tFogOptions.maximumOpacity = options.maximumOpacity; + tFogOptions.inScatteringSize = options.inScatteringSize; + tFogOptions.fogColorFromIbl = options.fogColorFromIbl; tFogOptions.skyColor = (options.skyColor as FFITexture?)?.pointer ?? nullptr; - tFogOptions.linearColor.x = options.linearColor.r; - tFogOptions.linearColor.y = options.linearColor.x; - tFogOptions.linearColor.z = options.linearColor.x; - View_setFogOptions(this.view, tFogOptions.address); + tFogOptions.linearColorR = options.linearColor.r; + tFogOptions.linearColorG = options.linearColor.g; + tFogOptions.linearColorB = options.linearColor.b; + tFogOptions.enabled = options.enabled; + View_setFogOptions(this.view, tFogOptions); } }