Class DrawWrapper
Constructors
constructor
-
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
- engine: AbstractEngine
Properties
defines
The defines associated with this wrapper.
Optionaldraw Context
The draw context associated with this wrapper.
effect
The effect associated with this wrapper.
Optionalmaterial Context
The material context associated with this wrapper.
Methods
dispose
-
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
- immediate: boolean = false
set Effect
-
setEffect(
effect: Nullable<Effect>,
defines?: Nullable<string | MaterialDefines>,
resetContext?: boolean,
): voidSets the effect and its associated defines for this wrapper.
Parameters
- effect: Nullable<Effect>
The effect to associate with this wrapper.
Optionaldefines: Nullable<string | MaterialDefines>The defines to associate with this wrapper.
- resetContext: boolean = true
If true, resets the draw context (default is true).
Returns void
- effect: Nullable<Effect>
StaticGet Effect
-
Retrieves the effect from a DrawWrapper or Effect instance.
Parameters
- effect: Effect | DrawWrapper
The effect or DrawWrapper instance to retrieve the effect from.
Returns Nullable<Effect>
The effect associated with the given instance, or null if not found.
- effect: Effect | 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.