final class CubeTexture
package openfl.display3D.textures
extends TextureBase › EventDispatcher
Available on all platforms
The CubeTexture class represents a cube texture uploaded to a rendering context.
Defines a cube map texture for use during rendering. Cube mapping is used for many rendering techniques, such as environment maps, skyboxes, and skylight illumination.
You cannot create a CubeTexture object directly; use the Context3D
createCubeTexture()
instead.
Methods
uploadCompressedTextureFromByteArray(data:ByteArray, byteArrayOffset:UInt, async:Bool = false):Void
Uploads a cube texture in Adobe Texture Format (ATF) from a byte array.
The byte array must contain all faces and mipmaps for the texture.
Parameters:
data | a byte array that containing a compressed cube texture including mipmaps. The ByteArray object must use the little endian format. |
---|---|
byteArrayOffset | an optional offset at which to start reading the texture data. |
async | If |
Throws:
TypeError | Null Pointer Error: when |
---|---|
ArgumentError | Texture Decoding Failed: when the compression format of this object cannot be derived from the format of the compressed data in data. |
ArgumentError | Texture Needs To Be Square: when the decompressed texture
does not have equal |
ArgumentError | Texture Size Does Not Match: when the width and height of the decompressed texture do not equal the length of the texture's edge. |
ArgumentError | Miplevel Too Large: if the mip level of the decompressed texture is greater than that implied by the length of the texture's edge. |
ArgumentError | Texture Format Mismatch: if the decoded ATF bytes don't contain a texture compatible with this texture's format or is not a cube texture. |
Error | 3768: The Stage3D API may not be used during background execution. |
RangeError | Bad Input Size: when there is integer overflow of
|
uploadFromBitmapData(source:BitmapData, side:UInt, miplevel:UInt = 0, generateMipmap:Bool = false):Void
Uploads a component of a cube map texture from a BitmapData object.
This function uploads one mip level of one side of the cube map. Call
uploadFromBitmapData()
as necessary to upload each mip level and face of the
cube map.
Parameters:
source | a bitmap. |
---|---|
side | A code indicating which side of the cube to upload: positive X : 0 negative X : 1 positive Y : 2 negative Y : 3 positive Z : 4 negative Z : 5 |
miplevel | the mip level to be loaded, level zero being the top-level full-resolution image. The default value is zero. |
Throws:
TypeError | Null Pointer Error: if source is |
---|---|
ArgumentError | Miplevel Too Large: if the specified mip level is greater than that implied by the the texture's dimensions. |
ArgumentError | Invalid Cube Side: if side is greater than 5. |
ArgumentError | Invalid BitmapData Error: if source if the BitmapData object does not contain a valid cube texture face. The image must be square, with sides equal to a power of two, and the correct size for the miplevel specified. |
ArgumentError | Texture Format Mismatch: if the texture format is
|
Error | 3768: The Stage3D API may not be used during background execution. |
uploadFromByteArray(data:ByteArray, byteArrayOffset:UInt, side:UInt, miplevel:UInt = 0):Void
Uploads a component of a cube map texture from a ByteArray object.
This function uploads one mip level of one side of the cube map. Call
uploadFromByteArray()
as neccessary to upload each mip level and face of the
cube map.
Parameters:
data | a byte array containing the image in the format specified when this CubeTexture object was created. The ByteArray object must use the little endian format. |
---|---|
byteArrayOffset | reading of the byte array starts there. |
side | A code indicating which side of the cube to upload: positive X : 0 negative X : 1 positive Y : 2 negative Y : 3 positive Z : 4 negative Z : 5 |
miplevel | the mip level to be loaded, level zero is the top-level, full-resolution image. |
Throws:
TypeError | Null Pointer Error: when data is null. |
---|---|
ArgumentError | Miplevel Too Large: if the specified mip level is greater than that implied by the Texture's dimensions. |
RangeError | Bad Input Size: if the number of bytes available from byteArrayOffset to the end of the data byte array is less than the amount of data required for a texture of this mip level or if byteArrayOffset is greater than or equal to the length of data. |
ArgumentError | Texture Format Mismatch: if the texture format is Context3DTextureFormat.COMPRESSED or Context3DTextureFormat.COMPRESSED_ALPHA and the code is executing on a mobile platform where runtime texture compression is not supported. |
Error | 3768: The Stage3D API may not be used during background execution. |
uploadFromTypedArray(data:ArrayBufferView, side:UInt, miplevel:UInt = 0):Void
Uploads a component of a cube map texture from an ArrayBufferView object.
This function uploads one mip level of one side of the cube map. Call
uploadFromTypedArray()
as necessary to upload each mip level and face of the
cube map.
Parameters:
data | a typed array containing the image in the format specified when this CubeTexture object was created. |
---|---|
side | A code indicating which side of the cube to upload: positive X : 0 negative X : 1 positive Y : 2 negative Y : 3 positive Z : 4 negative Z : 5 |
miplevel | the mip level to be loaded, level zero is the top-level, full-resolution image. |