Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SimpleTexture

The simple texture base class. It create the GFX Texture and can set mipmap levels.

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

Private _mipmapLevel

_mipmapLevel: number = 1

_native

_native: string = ""

Serializable url for native asset. For internal usage.

default

""

_nativeUrl

_nativeUrl: string = ""

Private _textureHeight

_textureHeight: number = 0

Private _textureWidth

_textureWidth: number = 0

_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 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

isCompressed

  • get isCompressed(): boolean

mipmapLevel

  • get mipmapLevel(): number

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

  • deserialize(serializedData: any, handle: any): void

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
  • Set mipmap level of this texture. The value is passes as presumed info to this._getGfxTextureCreateInfo().

    Parameters

    • value: number

      The mipmap level.

    Returns 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

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
  • Update the given level mipmap image.

    Parameters

    • Default value firstLevel: number = 0

      First level to be updated

    • Optional count: undefined | number

      Mipmap level count to be updated

    Returns 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

Generated using TypeDoc