fromKtx2Asset static method
Future<EnvironmentMap>
fromKtx2Asset({
- required String assetPath,
- String? diffuseShAssetPath,
- List<
Vector3> ? diffuseSphericalHarmonics, - AssetBundle? bundle,
Loads an EnvironmentMap from a pre-baked KTX2 radiance cubemap in the asset bundle (see fromKtx2Bytes for the accepted conventions).
diffuseShAssetPath, when given, is a sidecar of
kDiffuseShSidecarByteLength bytes holding the diffuse spherical
harmonics; a file that carries them in its own kDiffuseShKtx2Key
metadata needs no sidecar.
Implementation
static Future<EnvironmentMap> fromKtx2Asset({
required String assetPath,
String? diffuseShAssetPath,
List<Vector3>? diffuseSphericalHarmonics,
AssetBundle? bundle,
}) async {
final environment = await fromKtx2Bytes(
await bytesFromAsset(assetPath, bundle: bundle),
diffuseSphericalHarmonics: diffuseSphericalHarmonics,
diffuseShSidecar: diffuseShAssetPath == null
? null
: await bytesFromAsset(diffuseShAssetPath, bundle: bundle),
);
_environmentAssetPaths[environment] = assetPath;
return environment;
}