Interface IDrawContext
interface IDrawContext {
enableIndirectDraw: boolean;
indirectDrawBuffer?: GPUBuffer;
uniqueId: number;
useInstancing: boolean;
dispose(): void;
reset(): void;
setIndirectData(
indexOrVertexCount: number,
instanceCount: number,
firstIndexOrVertex: number,
forceUpdate?: boolean,
): void;
}
enableIndirectDraw: boolean;
indirectDrawBuffer?: GPUBuffer;
uniqueId: number;
useInstancing: boolean;
dispose(): void;
reset(): void;
setIndirectData(
indexOrVertexCount: number,
instanceCount: number,
firstIndexOrVertex: number,
forceUpdate?: boolean,
): void;
}
Implemented by
Properties
enable Indirect Draw
enableIndirectDraw: boolean
Indicates if the draw should be an indirect draw.
Optionalindirect Draw Buffer
indirectDrawBuffer?: GPUBuffer
Buffer used for the indirect draw call when enableIndirectDraw is true.
unique Id
uniqueId: number
Unique identifier for the draw context.
use Instancing
useInstancing: boolean
True if instances are used in the draw calls
Methods
dispose
-
Disposes the draw context and its resources.
Returns void
reset
-
Resets the draw context to its initial state.
Returns void
set Indirect Data
-
setIndirectData(
indexOrVertexCount: number,
instanceCount: number,
firstIndexOrVertex: number,
forceUpdate?: boolean,
): voidData for the indirect draw call (only used when enableIndirectDraw is true).
Parameters
- indexOrVertexCount: number
The number of indices (if indexed draw) or vertices (if non-indexed draw).
- instanceCount: number
The number of instances to draw.
- firstIndexOrVertex: number
The index (if indexed draw) or vertex (if non-indexed draw) offset to start drawing from.
OptionalforceUpdate: booleanIf true, forces the update of the indirect draw data even if instanceCount is the same as in the previous call.
Returns void
- indexOrVertexCount: number
Interface representing a draw context at the GPU level (draw call)