new Texture2D()
Properties:
Name | Type | Description |
---|---|---|
name |
The name of the texture. |
|
width |
The texture's width |
|
height |
The texture's height |
Methods
-
initEmpty(width, height, format, dataType)
-
Inits an empty texture.
Parameters:
Name Type Description width
The width of the texture.
height
The height of the texture.
format
TextureFormat The texture's format.
dataType
number The texture's data format.
-
uploadCompressedData(data, width, height, generateMips, internalFormat, mipLevel)
-
Uploads compressed data.
Parameters:
Name Type Description data
* An typed array containing the initial data.
width
number The width of the texture.
height
number The height of the texture.
generateMips
boolean Whether or not a mip chain should be generated.
internalFormat
* The texture's internal compression format.
mipLevel
number The target mip map level. Defaults to 0. If provided, generateMips should be false.
-
uploadData(data, width, height, generateMips, format, dataType, mipLevel)
-
Initializes the texture with the given data.
Parameters:
Name Type Description data
* An typed array containing the initial data.
width
number The width of the texture.
height
number The height of the texture.
generateMips
boolean Whether or not a mip chain should be generated.
format
TextureFormat The texture's format.
dataType
DataType The texture's data format.
mipLevel
number The target mip map level. Defaults to 0. If provided, generateMips should be false.
-
uploadImage(image, width, height, generateMips, format, dataType, mipLevel)
-
Initializes the texture with a given Image.
Parameters:
Name Type Description image
The Image to upload to the texture
width
The width of the texture.
height
The height of the texture.
generateMips
Whether or not a mip chain should be generated.
format
TextureFormat The texture's format.
dataType
DataType The texture's data format.
mipLevel
number The target mip map level. Defaults to 0. If provided, generateMips should be false.