Add Node.fromGlbStream factory for Stream<List<int>> input#129
Open
aki1770-del wants to merge 1 commit into
Open
Add Node.fromGlbStream factory for Stream<List<int>> input#129aki1770-del wants to merge 1 commit into
aki1770-del wants to merge 1 commit into
Conversation
Sibling to the existing Node.fromGlbBytes / Node.fromGlbAsset factories, accepting a Stream<List<int>> source instead of a materialised Uint8List or asset path. Use cases this opens up: - HTTP response bodies via `package:http` (response.stream) - `dart:io` File.openRead() pipes - Websocket frame sources - Any caller with a chunked byte source but no full buffer up-front Implementation drains the stream into a BytesBuilder and delegates to fromGlbBytes — peak memory equals the full GLB size, matching fromGlbBytes semantics. True incremental parsing of the GLB container is intentionally out of scope for this factory. The factory accepts Stream<List<int>> (Dart-idiomatic; matches dart:io and package:http conventions); Stream<Uint8List> callers work transparently since Uint8List implements List<int>. Test covers stream-collection contract directly without flutter_gpu pipeline instantiation (which is unavailable in pure dart:test): chunked input produces byte-identical output for fcar.glb; Stream<Uint8List> upcast handles correctly; empty stream produces empty bytes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sibling to the existing
Node.fromGlbBytes/Node.fromGlbAssetfactories, accepting aStream<List<int>>source instead of a materialisedUint8Listor asset path.Use cases this opens up:
package:http(response.stream)dart:ioFile.openRead()pipesImplementation drains the stream into a
BytesBuilderand delegates tofromGlbBytes— peak memory equals the full GLB size, matchingfromGlbBytessemantics. True incremental parsing of the GLB container is intentionally out of scope for this factory.The factory accepts
Stream<List<int>>(Dart-idiomatic; matchesdart:ioandpackage:httpconventions);Stream<Uint8List>callers work transparently sinceUint8ListimplementsList<int>.On the test approach: existing runtime-importer tests like
runtime_importer_byte_comparison_test.dartrequireflutter_gpu. The new test guards the stream-collection code path directly (withoutflutter_gpu) so it remains runnable in pure-dart:testCI. Happy to migrate to aflutter_gpu-enabled test instead if that fits the test suite layout better.AI-assisted — authored with Claude, reviewed by Komada.