From 43b5cb040aa8521781e09110460ca5b109691d41 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Sun, 19 May 2024 14:16:30 +0800 Subject: [PATCH] add missing getter for float pointer --- .../dart_filament/compatibility/web/allocator.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dart_filament/lib/dart_filament/compatibility/web/allocator.dart b/dart_filament/lib/dart_filament/compatibility/web/allocator.dart index f27cbcad..73627471 100644 --- a/dart_filament/lib/dart_filament/compatibility/web/allocator.dart +++ b/dart_filament/lib/dart_filament/compatibility/web/allocator.dart @@ -17,7 +17,8 @@ export 'dart:ffi' DoublePointer, Int32Pointer, Int64Pointer, - PointerPointer, Allocator; + PointerPointer, + Allocator; class Allocator implements ffi.Allocator { const Allocator(); @@ -142,6 +143,10 @@ extension FloatPointer on ffi.Pointer { flutter_filament_web_set_float(this, 0, value); } + double operator [](int index) { + return this.elementAt(index).value; + } + void operator []=(int index, double value) { this.elementAt(index).value = value; } @@ -153,7 +158,7 @@ extension FloatPointer on ffi.Pointer { var list = Float32List(length); for (int i = 0; i < length; i++) { - list[i] = elementAt(i).value; + list[i] = this[i]; } return list; } @@ -173,8 +178,6 @@ extension StringConversion on String { } extension StringUtf8Pointer on ffi.Pointer { - - static int _length(ffi.Pointer codeUnits) { var length = 0; while (codeUnits[length] != 0) {