Contents

init(program:)

Creates a portal material from a previously compiled program.

Declaration

init(program: PortalMaterial.Program)

Parameters

  • program:

    A compiled portal program. The resulting material shares the program’s compiled shader artifact.

Discussion

Because init(descriptor:) is asynchronous, preload the programs your scene needs once during setup, then use this initializer to instantiate portal materials from them synchronously at runtime — for example, when populating a model component each frame.

After creating the material, bind its shader inputs by calling setParameter(name:value:) or setParameter(handle:value:).