preload static method
Loads engine resources that otherwise load the first time something needs them, along with initializeStaticResources, so a loading screen absorbs the cost.
physicalMaterials loads the shaders behind PhysicallyBasedMaterial's
extensions (clearcoat, sheen, transmission, and the rest) and
ShadowCatcherMaterial. smaa loads the tables AntiAliasingMode.smaa
needs. Without this, a scene holds its last frame while one of its
materials waits for those shaders, and renders without SMAA until the
tables arrive. Await it before a one-shot render or capture that uses
either.
Safe to call more than once. Retries a load that failed, and completes with its error.
Implementation
static Future<void> preload({
bool physicalMaterials = true,
bool smaa = false,
}) async {
await Future.wait([
initializeStaticResources(),
if (physicalMaterials) initializePhysicalMaterialResources(),
if (smaa) SmaaPass.initializeStaticResources(),
]);
}