API

Class DrawWrapper

Wrapper for an effect and its associated material context and draw context. This class is meant to encapsulate the effect and its related contexts, allowing for easier management of rendering states.

Index
  • Creates a new DrawWrapper instance. Note that drawContext is always created (but may end up being undefined if the engine doesn't need draw contexts), but materialContext is optional.

    Parameters

    • engine: AbstractEngine

      The engine to create the draw wrapper for.

    • createMaterialContext: boolean = true

      If true, creates a material context for this wrapper (default is true).

    Returns DrawWrapper

defines: Nullable<string | MaterialDefines>

The defines associated with this wrapper.

drawContext?: IDrawContext

The draw context associated with this wrapper.

effect: Nullable<Effect>

The effect associated with this wrapper.

materialContext?: IMaterialContext

The material context associated with this wrapper.

  • Disposes the effect wrapper and its resources

    Parameters

    • immediate: boolean = false

      if the effect should be disposed immediately or on the next frame. If dispose() is not called during a scene or engine dispose, we want to delay the dispose of the underlying effect. Mostly to give a chance to user code to reuse the effect in some way.

    Returns void