flutter3d_build 0.7.1
flutter3d_build: ^0.7.1 copied to clipboard
The build hook behind `dart run flutter3d_build:init`: converts model and texture sources into what the engine loads, on every build rather than as a step somebody remembers to run.
0.7.1 #
The manifest's doc says what glob 2.2.0 does: **/*.obj matches a
root-level a.obj as well as props/a.obj.
Its flutter3d_* dependencies ask for ^0.7.1, and it asks for code_assets ^2.1.0, glob ^2.2.0, yaml ^3.1.4, image ^4.10.1, vector_math ^2.4.3.
0.7.0 #
- The first publication. The 0.6.0 below was a number carried inside the
workspace and never reached pub.dev, and it describes a scaffold with no
exports. 0.7.0 is the number the whole shelf goes out on, so one number names
one tree and
^0.7.0on anyflutter3d_*package resolves against every other;doc/boundary-0.7.0.mdlists the thirteen packages that begin here. What follows is what the scaffold was filled in with. The package is plain Dart: it depends onflutter3d_corefor the decoders and encoders, onhooksandcode_assetsfor the build-hook contract, and onglob,yaml,cryptoandimage. dart run flutter3d_build:convert <model-or-directory>. Converts a glTF, GLB, OBJ or STL model into the engine's.f3dcontainer, and a directory converts every recognised model under it.-onames the output file or directory, and--texturestakesauto,bc,etc2,universalornone.bcwrites BC1 for an opaque image and BC3 for one with alpha.etc2writes ETC2 RGB8 and leaves an image with alpha as it arrived, saying so, because the EAC alpha block is not encoded. An image whose sides are not multiples of four is left as it arrived too.runConvert,convertOne,ConvertOptions,TextureFamilyandencodeDocumentTexturesare the same from Dart.TextureFamilyis a final class with static constants and not an enum, so aswitchover one needs a default.buildAssets(input, output)is the build hook. A project'shook/build.dartcalls it. With no configuration everything underassets_src/is converted intoflutter3d_generated/at the same relative path with the extension.f3d, which isAssetLayout.plan. Aflutter3d_assets.yamloverrides that per glob throughAssetManifest: the texture family,mips, how an OBJ without normals gets them, orexclude, with the last matching rule winning, and aManifestFormatExceptionnames the line. The glob**/*.objdoes not match a file directly underassets_src/;**.objmatches both.- A source is converted again when its content changed, and not when its
date did.
runAssetBuildkeeps a cache of a content hash per source with the texture family that wrote the output and two version stamps,kAssetPipelineVersionand the.f3dformat's own, and any of the four moving converts the file again. A cache that cannot be read converts everything.AssetBuildReportlists what wasconverted, what wasskippedand thedependenciesthe hook declares, so the next build is asked for when one of them changes. - The hook picks the texture family from the platform it builds for.
familyForTargetOSanswersbcfor macOS, Windows and Linux,etc2for Android and iOS, andauto, which converts no texture, for anything else, the web included. Atextures:value under this package's key in the project'shook_user_definescomes first. The target is read only when the build input carries a code configuration. - A compressed texture carries a mip chain. Each level is a box filter of the one above in the channel's stored values, down to the last level that is whole 4x4 blocks: a 64-pixel image gets five levels and a 12-pixel one gets one.
--textures universalcooks one texture for every device. It writes a 4x4 block intermediate ofkUniversalBlockBytes, twenty, bytes a block that is not a GPU format, andflutter3d_core's upload turns it into BC1, BC3, ASTC 4x4, ETC2 or RGBA8 against what the device says it samples. A project that ships to desktop and phone from one build sets it inhook_user_defines.--no-mipsskips something. It was accepted and answered with a note, because nothing generated a chain to skip; every compressed family has since learned to write one.convertOneandencodeDocumentTexturestakemips:, and with it false a texture keeps its base level alone —bc,etc2anduniversalalike. The note--textures autoprints, and the usage text, stop promising a per-target choice the converter was never going to make: a build hook is told its target and resolvesauto, a command line names a family, anduniversalis the one that needs no target at all.- A project stops needing a person to wire up its own build hook.
dart run flutter3d_build:init(ap-10) writes the four things the hook needs —hook/build.dart, adev_dependencies:line on this package, theflutter: assets:entries for the generated directory, and a.gitignoreline for it — each idempotent on its own, so a second run is an empty diff.--checkreports what a run would change and changes nothing; ahook/build.dartsomebody edited is reported and left alone without--force. Oneassets:entry per generated subdirectory, not one for the root: Flutter bundles a declared directory without recursing, so a singleflutter3d_generated/line ships the hook's own cache file and silently drops every model converted undermodels/.
0.6.0 #
- The scaffold, and nothing else.
ap-02indoc/asset-pipeline-plan.md: a plain Dart package,flutter3d_formatsandflutter3d_geometryfor the decoders a hook will convert through,package:hooksfor the contractap-00's spike proved works on macOS, web, Android and iOS withoutpackage:data_assets, which stays experimental on stable. No exports yet — those arrive withap-03throughap-05.