t3d. TextureBase

Create a texture to apply to a surface or as a reflection or refraction map.

Constructor

(abstract) new TextureBase()

Extends

Members

anisotropy :Number

The number of samples taken along the axis through the pixel that has the highest density of texels. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use WebGLcapabilities#maxAnisotropy to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.
Type:
  • Number
Default Value
  • 1

border :Number

WebGLTexture border. See WebGLTexture texImage2D(). Must be zero.
Type:
  • Number

compare :t3d.COMPARE_FUNC|Undefined

Use for shadow sampler (WebGL 2.0 Only).
Type:
Default Value
  • undefined

encoding :t3d.TEXEL_ENCODING_TYPE

texture pixel encoding.
Default Value
  • t3d.TEXEL_ENCODING_TYPE.LINEAR

flipY :Boolean

If set to true, the texture is flipped along the vertical axis when uploaded to the GPU. Default is true to flips the image's Y axis to match the WebGL texture coordinate space. Note that this property has no effect for ImageBitmap. You need to configure on bitmap creation instead.
Type:
  • Boolean
Default Value
  • true

format :t3d.PIXEL_FORMAT

WebGLTexture texel data format.
Default Value
  • t3d.PIXEL_FORMAT.RGBA

generateMipmaps :Boolean

Whether to generate mipmaps (if possible) for a texture. Set this to false if you are creating mipmaps manually.
Type:
  • Boolean
Default Value
  • true

(readonly) id :Number

Unique number for this texture instance.
Type:
  • Number

internalformat :Null|t3d.PIXEL_FORMAT

The default value is null, the texture's internal format will be obtained using a combination of .format and .type. Users can also specify a specific internalFormat.
Type:
Default Value
  • null

(readonly) isTexture :Boolean

Type:
  • Boolean
Default Value
  • true

magFilter :t3d.TEXTURE_FILTER

How the texture is sampled when a texel covers more than one pixel.
Default Value
  • t3d.TEXTURE_FILTER.LINEAR

minFilter :t3d.TEXTURE_FILTER

How the texture is sampled when a texel covers less than one pixel.
Default Value
  • t3d.TEXTURE_FILTER.LINEAR_MIPMAP_LINEAR

mipmaps :Array.<HTMLImageElement>|Array.<Object>

Array of user-specified mipmaps (optional).
Type:
  • Array.<HTMLImageElement> | Array.<Object>
Default Value
  • []

premultiplyAlpha :Boolean

If set to true, the alpha channel, if present, is multiplied into the color channels when the texture is uploaded to the GPU. Note that this property has no effect for ImageBitmap. You need to configure on bitmap creation instead.
Type:
  • Boolean
Default Value
  • false

type :t3d.PIXEL_TYPE

WebGLTexture texel data type.
Default Value
  • t3d.PIXEL_TYPE.UNSIGNED_BYTE

unpackAlignment :Number

Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries).
Type:
  • Number
Default Value
  • 4

version :Number

version code increse if texture changed. if version is still 0, this texture will be skiped.
Type:
  • Number
Default Value
  • 0

wrapS :t3d.TEXTURE_WRAP

This defines how the texture is wrapped horizontally and corresponds to U in UV mapping.
Default Value
  • t3d.TEXTURE_WRAP.CLAMP_TO_EDGE

wrapT :t3d.TEXTURE_WRAP

This defines how the texture is wrapped vertically and corresponds to V in UV mapping.
Default Value
  • t3d.TEXTURE_WRAP.CLAMP_TO_EDGE

Methods

addEventListener(type, listener, thisObjectopt)

Adds a listener to an event type.
Parameters:
NameTypeAttributesDefaultDescription
typeStringThe type of event to listen to.
listenerfunctionThe function that gets called when the event is fired.
thisObjectObject<optional>
thisThe Object of calling listener method.

clone() → {t3d.TextureBase}

Returns a clone of this texture.
Returns:
Type: 
t3d.TextureBase

copy(source) → {t3d.TextureBase}

Copy the given texture into this texture.
Parameters:
NameTypeDescription
sourcet3d.TextureBaseThe texture to be copied.
Returns:
Type: 
t3d.TextureBase

dispatchEvent(event)

Fire an event.
Parameters:
NameTypeDescription
eventObjectThe event that gets fired.

dispose()

Dispatches a dispose event.

removeEventListener(type, listener, thisObjectopt)

Removes a listener from an event type.
Parameters:
NameTypeAttributesDefaultDescription
typeStringThe type of the listener that gets removed.
listenerfunctionThe listener function that gets removed.
thisObjectObject<optional>
thisthisObject - The Object of calling listener method.