Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextureCube

The texture cube asset. Each mipmap level of a texture cube have 6 ImageAsset, represents 6 faces of the cube.

Hierarchy

Index

Constructors

constructor

Properties

__asyncLoadAssets__

__asyncLoadAssets__: boolean = false

__depends__

__depends__: any = null

__nativeDepend__

__nativeDepend__: any = null

__onLoadedInvoked__

__onLoadedInvoked__: boolean = false

Protected _anisotropy

_anisotropy: number = 8

Protected _format

_format: number = PixelFormat.RGBA8888

Protected _gfxTexture

_gfxTexture: Texture | null = null

Protected _height

_height: number = 1

Protected _magFilter

_magFilter: number = Filter.LINEAR

Protected _minFilter

_minFilter: number = Filter.LINEAR

Protected _mipFilter

_mipFilter: number = Filter.NONE

_mipmaps

_mipmaps: ITextureCubeMipmap[] = []

_native

_native: string = ""

Serializable url for native asset. For internal usage.

default

""

_nativeUrl

_nativeUrl: string = ""

_uuid

_uuid: string

Protected _width

_width: number = 1

Protected _wrapR

_wrapR: number = WrapMode.REPEAT

Protected _wrapS

_wrapS: number = WrapMode.REPEAT

Protected _wrapT

_wrapT: number = WrapMode.REPEAT

loaded

loaded: boolean = true

Whether the asset is loaded or not

Static FaceIndex

FaceIndex: FaceIndex = FaceIndex

Static Filter

Filter: Filter = Filter

The texture filter mode enum

Static PixelFormat

PixelFormat: PixelFormat = PixelFormat

The pixel format enum.

Static WrapMode

WrapMode: WrapMode = WrapMode

The wrap mode enum.

Static preventDeferredLoadDependents

preventDeferredLoadDependents: boolean = false

Indicates whether its dependent native assets can support deferred load if the owner scene (or prefab) is marked as asyncLoadAssets.

default

false

Static preventPreloadNativeObject

preventPreloadNativeObject: boolean = false

Indicates whether its native object should be preloaded from native url.

default

false

Accessors

Private nativeAsset

  • get nativeAsset(): any
  • set nativeAsset(obj: any): void
  • The underlying native asset of this asset if one is available.
    This property can be used to access additional details or functionality releated to the asset.
    This property will be initialized by the loader if _native is available.

    default

    null

    Returns any

  • The underlying native asset of this asset if one is available.
    This property can be used to access additional details or functionality releated to the asset.
    This property will be initialized by the loader if _native is available.

    default

    null

    Parameters

    • obj: any

    Returns void

nativeDep

  • get nativeDep(): undefined | { __isNative__: boolean; ext: string; uuid: string }

height

  • get height(): number

image

isCompressed

  • get isCompressed(): boolean

mipmapLevel

  • get mipmapLevel(): number

mipmaps

nativeUrl

  • get nativeUrl(): string

refCount

  • get refCount(): number

width

  • get width(): number

Methods

Protected assignImage

  • assignImage(image: ImageAsset, level: number, arrayIndex?: undefined | number): void

Protected checkTextureLoaded

  • _checkTextureLoaded(): void

Protected createTexture

  • createTexture(device: Device): void

deserialize

Protected getGFXDevice

  • _getGFXDevice(): Device | null

Protected getGFXFormat

Protected getGFXPixelFormat

  • getGFXPixelFormat(format: any): Format

Protected getGfxTextureCreateInfo

serialize

  • serialize(ctxForExporting: any): any

Protected setGFXFormat

Protected setMipmapLevel

  • setMipmapLevel(value: number): void

Private setRawAsset

  • setRawAsset(filename: string, inLibrary?: boolean): void

Protected textureReady

  • _textureReady(): void

Protected tryDestroyTexture

  • _tryDestroyTexture(): void

Protected tryReset

  • _tryReset(): void

addRef

Optional createNode

decRef

  • decRef(autoRelease?: boolean): Asset

destroy

  • destroy(): any

getAnisotropy

  • getAnisotropy(): number

getGFXSampler

getGFXTexture

getHash

  • getHash(): number

getId

  • getId(): string

getPixelFormat

  • getPixelFormat(): number

Private getSamplerHash

  • getSamplerHash(): number

onLoaded

  • onLoaded(): void

releaseTexture

  • releaseTexture(): void

reset

Private serialize

  • serialize(): void

setAnisotropy

  • setAnisotropy(anisotropy: number): void

setFilters

setMipFilter

  • setMipFilter(mipFilter: Filter): void

setWrapMode

toString

  • toString(): string
  • Returns the string representation of the object.
    The Asset object overrides the toString() method of the Object object.
    JavaScript calls the toString() method automatically
    when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.

    For assets of the native type, it will return this.nativeUrl.
    Otherwise, an empty string is returned.
    This method may be overwritten by subclasses.

    method

    toString

    Returns string

updateImage

  • updateImage(): void

updateMipmaps

  • updateMipmaps(firstLevel?: number, count?: undefined | number): void

uploadData

  • uploadData(source: HTMLCanvasElement | HTMLImageElement | ArrayBufferView | ImageBitmap, level?: number, arrayIndex?: number): void
  • Upload data to the given mipmap level. The size of the image will affect how the mipmap is updated.

    • When the image is an ArrayBuffer, the size of the image must match the mipmap size.
    • If the image size matches the mipmap size, the mipmap data will be updated entirely.
    • If the image size is smaller than the mipmap size, the mipmap will be updated from top left corner.
    • If the image size is larger, an error will be raised

    Parameters

    • source: HTMLCanvasElement | HTMLImageElement | ArrayBufferView | ImageBitmap

      The source image or image data

    • Default value level: number = 0

      Mipmap level to upload the image to

    • Default value arrayIndex: number = 0

      The array index

    Returns void

Static deserialize

  • deserialize(data: any): any

Static fromTexture2DArray

  • Create a texture cube with an array of Texture2D which represents 6 faces of the texture cube.

    example
    const textures = new Array<Texture2D>(6);
    textures[TextureCube.FaceIndex.front] = frontImage;
    textures[TextureCube.FaceIndex.back] = backImage;
    textures[TextureCube.FaceIndex.left] = leftImage;
    textures[TextureCube.FaceIndex.right] = rightImage;
    textures[TextureCube.FaceIndex.top] = topImage;
    textures[TextureCube.FaceIndex.bottom] = bottomImage;
    const textureCube = TextureCube.fromTexture2DArray(textures);

    Parameters

    • textures: Texture2D[]

      Texture array, the texture count must be multiple of 6. Every 6 textures are 6 faces of a mipmap level. The order should obey FaceIndex order.

    • Optional out: TextureCube

      Output texture cube, if not given, will create a new texture cube.

    Returns TextureCube

    The created texture cube.

Generated using TypeDoc