Function updateTexture2DFromPixels
-
updateTexture2DFromPixels(
engine: EngineContext,
tex: Texture2D,
data: Uint8Array,
x?: number,
y?: number,
width?: number,
height?: number,
): voidParameters
- engine: EngineContext
Engine context.
- tex: Texture2D
Target texture (from
createTexture2DFromPixels). - data: Uint8Array
width * height * 4bytes for the sub-region, row-major, straight alpha. - x: number = 0
Destination origin X in texels (default 0).
- y: number = 0
Destination origin Y in texels (default 0).
- width: number = tex.width
Region width in texels (default
tex.width). - height: number = tex.height
Region height in texels (default
tex.height).
Returns void
- engine: EngineContext
Update a rectangular region of an existing
Texture2Dfrom a tightly-packed RGBA8 byte buffer.The texture must have been created with
COPY_DSTusage (ascreateTexture2DFromPixelsdoes). This is the runtime counterpart tocreateTexture2DFromPixels— for data textures the app mutates each frame / on demand (e.g. a terrain carve heightmap stamped by a dig tool).