diff --git a/thermion_dart/lib/src/bindings/src/thermion_dart_ffi.g.dart b/thermion_dart/lib/src/bindings/src/thermion_dart_ffi.g.dart index e841f04c..f780557e 100644 --- a/thermion_dart/lib/src/bindings/src/thermion_dart_ffi.g.dart +++ b/thermion_dart/lib/src/bindings/src/thermion_dart_ffi.g.dart @@ -552,6 +552,12 @@ external void View_setFrontFaceWindingInverted( bool inverted, ); +@ffi.Native, ffi.Pointer)>(isLeaf: true) +external void View_setFogOptions( + ffi.Pointer tView, + ffi.Pointer tFogOptions, +); + @ffi.Native< ffi.Void Function(ffi.Pointer, ffi.Uint32, ffi.Uint32, ffi.Uint32, PickCallback)>(isLeaf: true) @@ -3668,6 +3674,43 @@ final class TViewport extends ffi.Struct { external int height; } +/// Copied from FogOptions in View.h +final class TFogOptions extends ffi.Struct { + @ffi.Float() + external double distance; + + @ffi.Float() + external double cutOffDistance; + + @ffi.Float() + external double maximumOpacity; + + @ffi.Float() + external double height; + + @ffi.Float() + external double heightFalloff; + + external double3 linearColor; + + @ffi.Float() + external double density; + + @ffi.Float() + external double inScatteringStart; + + @ffi.Float() + external double inScatteringSize; + + @ffi.Bool() + external bool fogColorFromIbl; + + external ffi.Pointer skyColor; + + @ffi.Bool() + external bool enabled; +} + sealed class TToneMapping { static const ACES = 0; static const FILMIC = 1; diff --git a/thermion_dart/lib/src/bindings/src/thermion_dart_js_interop.g.dart b/thermion_dart/lib/src/bindings/src/thermion_dart_js_interop.g.dart index 270005e3..012c4f0e 100644 --- a/thermion_dart/lib/src/bindings/src/thermion_dart_js_interop.g.dart +++ b/thermion_dart/lib/src/bindings/src/thermion_dart_js_interop.g.dart @@ -253,7 +253,7 @@ sealed class Struct extends NativeType { final Pointer _address; Struct(this._address); - + static create() { switch (T) { case double4x4: @@ -269,7 +269,7 @@ sealed class Struct extends NativeType { return double4x4(arr1, arr2, arr3, arr4, ptr) as T; } throw Exception(); - } + } } extension StructPointer on T { @@ -2883,10 +2883,9 @@ void View_setFrontFaceWindingInverted( void View_setFogOptions( self.Pointer tView, - TFogOptions tFogOptions, + self.Pointer tFogOptions, ) { - final tFogOptionsPtr = tFogOptions._address; - final result = _lib._View_setFogOptions(tView.cast(), tFogOptionsPtr.cast()); + final result = _lib._View_setFogOptions(tView.cast(), tFogOptions.cast()); return result; } @@ -6348,6 +6347,7 @@ extension TFogOptionsExt on Pointer { var height = _lib.getValue(this + 12, "float").toDartDouble; var heightFalloff = _lib.getValue(this + 16, "float").toDartDouble; var linearColor = _lib.getValue(this + 20, "*").toDartInt; + final linearColorPtr = Pointer(linearColor); var density = _lib.getValue(this + 44, "float").toDartDouble; var inScatteringStart = _lib.getValue(this + 48, "float").toDartDouble; var inScatteringSize = _lib.getValue(this + 52, "float").toDartDouble; @@ -6361,13 +6361,13 @@ extension TFogOptionsExt on Pointer { maximumOpacity, height, heightFalloff, - linearColor, + linearColorPtr.toDart(), density, inScatteringStart, inScatteringSize, - fogColorFromIbl, + fogColorFromIbl == 1, skyColor.cast(), - enabled, + enabled == 1, this); } @@ -6377,13 +6377,15 @@ extension TFogOptionsExt on Pointer { _lib.setValue(this + 8, dartType.maximumOpacity.toJS, "float"); _lib.setValue(this + 12, dartType.height.toJS, "float"); _lib.setValue(this + 16, dartType.heightFalloff.toJS, "float"); - _lib.setValue(this + 20, dartType.linearColor.toJS, "*"); + _lib.setValue(this + 20, dartType.linearColor.x.toJS, "double"); + _lib.setValue(this + 28, dartType.linearColor.y.toJS, "double"); + _lib.setValue(this + 36, dartType.linearColor.z.toJS, "double"); _lib.setValue(this + 44, dartType.density.toJS, "float"); _lib.setValue(this + 48, dartType.inScatteringStart.toJS, "float"); _lib.setValue(this + 52, dartType.inScatteringSize.toJS, "float"); - _lib.setValue(this + 56, dartType.fogColorFromIbl.toJS, "i8"); + _lib.setValue(this + 56, dartType.fogColorFromIbl ? 1.toJS : 0.toJS, "i8"); _lib.setValue(this + 57, dartType.skyColor.addr.toJS, "*"); - _lib.setValue(this + 61, dartType.enabled.toJS, "i8"); + _lib.setValue(this + 61, dartType.enabled ? 1.toJS : 0.toJS, "i8"); } }