initializeStaticResources static method

Future<void> initializeStaticResources()

Builds the shared BRDF/LTC lookup atlas.

Called by the Scene constructor; rendering is gated on the returned Future completing. The texture is built once and reused. The physical material shaders load separately, on first use or through Scene.preload.

Implementation

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