initializeStaticResources static method

Future<void> initializeStaticResources()

Builds the BRDF lookup texture and loads the physical shader variants.

Called by the Scene constructor; rendering is gated on the returned Future completing. The texture is built once and reused.

Implementation

static Future<void> initializeStaticResources() async {
  if (_brdfLutTexture == null) {
    final ltc = await rootBundle.load(
      'packages/flutter_scene/assets/ltc.bin',
    );
    _brdfLutTexture = buildBrdfLutTexture(
      ltcHalfData: ltc.buffer.asUint16List(
        ltc.offsetInBytes,
        ltc.lengthInBytes ~/ 2,
      ),
    );
  }
  await PhysicallyBasedMaterial.initializeStaticResources();
}