Capítulo 223 de 859

Chapter 223: DataTexture

Core Idea

Creates a texture directly from raw buffer data.

The interpretation of the data depends on type and format: If the type is UnsignedByteType, a Uint8Array will be useful for addressing the texel data. If the format is RGBAFormat, data needs four values for one texel; Red, Green, Blue and Alpha (typically the opacity).

Key Concepts

  • flipY : boolean: If set to true, the texture is flipped along the vertical axis when uploaded to the GPU.
  • generateMipmaps : boolean: Whether to generate mipmaps (if possible) for a texture.
  • image : Object: The image definition of a data texture.
  • isDataTexture : boolean (readonly): This flag can be used for type testing.
  • unpackAlignment : boolean: Specifies the alignment requirements for the start of each pixel row in memory.

Reference Tables

Constructor

Signature
new DataTexture( data : TypedArray, width : number, height : number, format : number, type : number, mapping : number, wrapS : number, wrapT : number, magFilter : number, minFilter : number, anisotropy : number, colorSpace : string )

Properties

PropertyDescription
.flipY : booleanIf set to true, the texture is flipped along the vertical axis when uploaded to the GPU.
.generateMipmaps : booleanWhether to generate mipmaps (if possible) for a texture.
.image : ObjectThe image definition of a data texture.
.isDataTexture : boolean (readonly)This flag can be used for type testing.
.unpackAlignment : booleanSpecifies the alignment requirements for the start of each pixel row in memory.

Key Takeaways

  1. DataTexture extends: EventDispatcher → Texture
  2. Most relevant properties: flipY, generateMipmaps, image, isDataTexture.

Connects To