loadFmatSky function Materials

Future<PreprocessedSky> loadFmatSky(
  1. String sourcePath, {
  2. String? package,
  3. String? bundleName,
  4. AssetBundle? bundle,
})

Loads a DataAssets-backed .fmat sky by its source path relative to the owning package's root (for example assets/gradient_sky.fmat).

The .fmat must declare a sky { vec3 Sky(vec3 direction) } block. Assign the result to Scene.skybox via a Skybox. Pass package and/or bundleName to disambiguate when the same source path is provided by more than one bundle.

Implementation

Future<PreprocessedSky> loadFmatSky(
  String sourcePath, {
  String? package,
  String? bundleName,
  AssetBundle? bundle,
}) async {
  final registry = await FmatMaterialRegistry.load(bundle: bundle);
  return registry.loadSky(sourcePath, package: package, bundleName: bundleName);
}