genBinRenderables2D

View sourcegenBinRenderables2D<T extends Material>(assettype: Constructor<T>, componenttype: object): SystemFunc

Creates a system that rebuilds 2D opaque render passes for one Material type.

assettype supplies the material type ID used as the pass key, while componenttype identifies the matching MaterialInstance component for T. The returned system queries renderables with GlobalTransform2D, Meshed, and componenttype, and cameras with RenderLists2D, GlobalTransform2D, and Camera.

Each matching camera’s render lists are cleared before a new opaque pass is created for the material type. Every matching renderable is then appended as a RenderType using its material handle ID, mesh handle ID, and resolved transform. The same renderables are added to every matching camera; this factory does not perform visibility or frustum filtering. With no matching camera, the generated system does no work.

MaterialInstancePlugin normally installs this system for a material/component pair. The factory itself only returns the system.

Examples

const bin2D = genBinRenderables2D(BasicMaterial, BasicMaterialInstance)

app.registerSystem({
  schedule: AppSchedule.Update,
  system: bin2D
})

Type Parameters

T extends Material

Parameters

NameDescriptionDefault
assettype

Material asset constructor used for the pass key.

—
componenttype

Material-instance component constructor.

—

Returns

System that rebuilds 2D opaque render passes.