Skip to main content

CommandBuffer

A self-contained sequence of graphics commands that can be executed by the renderer.

TypeNameInterface Description
Functionsconstructor()

Parameters

rtti: - An optional native command buffer object. If not provided, a new one will be created.

Functionsblit(src: Texture | number, dest: Texture | number): void

Function: Adds a command to copy a texture to another.

Parameters

src: - The source texture or temporary render texture ID.

dest: - The destination texture or temporary render texture ID.

FunctionsblitWithMaterial(src: Texture | number, dest: Texture | number, material: Material, shaderPass: number, isCache: boolean, properties?: MaterialPropertyBlock): void

Function: Adds a command to copy a texture to another using a material.

Parameters

src: - The source texture or temporary render texture ID.

dest: - The destination texture or temporary render texture ID.

material: - The material to use for the blit operation.

shaderPass: - The shader pass to use.

isCache: - Whether to cache the blit operation.

properties: - An optional block of material properties to apply.

FunctionsclearAll(): void

Function: Clears all commands from the buffer.

FunctionsclearRenderTexture(clearColor: boolean, clearDepth: boolean, backgroundColor: Color, depth: number): void

Function: Adds a command to clear a render target.

Parameters

clearColor: - Whether to clear the color buffer.

clearDepth: - Whether to clear the depth buffer.

backgroundColor: - The color to clear with.

depth: - The depth value to clear with.

FunctionsdrawMesh(mesh: Mesh, matrix: Matrix4x4f, material: Material, submeshIndex: number, shaderPass: number, properties?: MaterialPropertyBlock | undefined, isCache?: boolean): void

Function: Adds a command to draw a mesh.

Parameters

mesh: - The mesh to draw.

matrix: - The transformation matrix to use.

material: - The material to use.

submeshIndex: - The index of the submesh to render.

shaderPass: - The shader pass to use. Use -1 to render all passes.

properties: - Optional material properties to apply for this draw call.

isCache: - Whether to cache the draw operation.

FunctionssetGlobalColor(name: string, color: Color): void

Function: Adds a command to set a global shader color property.

Parameters

name: - The name of the color property.

color: - The color value to set.

FunctionssetGlobalFloat(name: string, value: number): void

Function: Adds a command to set a global shader float property.

Parameters

name: - The name of the float property.

value: - The float value to set.

FunctionssetGlobalMatrix(name: string, value: Matrix4x4f): void

Function: Adds a command to set a global shader matrix property.

Parameters

name: - The name of the matrix property.

value: - The matrix value to set.

FunctionssetGlobalTexture(name: string, texture: number | Texture): void

Function: Adds a command to set a global shader texture property.

Parameters

name: - The name of the texture property.

texture: - The texture to set, or a temporary render texture ID.

FunctionssetGlobalVector(name: string, value: Vector4f): void

Function: Adds a command to set a global shader vector property.

Parameters

name: - The name of the vector property.

value: - The vector value to set.

FunctionssetRenderTexture(target: Texture | number): void

Function: Adds a command to set the active render target.

Parameters

target: - The render target texture or a temporary render texture ID.

Examples

constructor()

let obj = new APJS.CommandBuffer();

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use CommandBuffer here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies