Constructor
new ImageTexture(param)
The image texture that load image resource and use by style.
Parameters:
Name | Type | Description |
---|---|---|
param |
Object | PixelBuffer | CanvasResource | The initial parameters. |
- Source:
Example
// Create image texture from pixel buffer with size
let imageTexture = new THING.ImageTexture({
data: pixelBuffer,
width: 128,
height: 128
});
// Create image texture from canvas
let imageTexture = new THING.ImageTexture({
resource: canvas
});
Extends
Members
anisotropy :Number
Get/Set the anisotropy.
Type:
- Number
- Overrides:
- Source:
colorFormat :Number
Get/Set the color format.
Type:
- Number
- Overrides:
- Source:
encoding :ImageEncodingType
Get/Set the encoding.
Type:
- Overrides:
- Source:
flipY :Boolean
Enable/Disable flipY.
Type:
- Boolean
- Overrides:
- Source:
generateMipmaps :Boolean
Enable/Disable generate mipmaps.
The minFilterType property will auto set to THING.ImageFilterType.LinearMipmapLinearFilter when generate mipmaps is enabled.
Type:
- Boolean
- Overrides:
- Source:
height :Number
Get height in pixel.
Type:
- Number
- Source:
isImageTexture :Boolean
Check class type.
Type:
- Boolean
- Source:
Example
if (texture.isImageTexture) {
console.log(`It's image texture`);
}
loaded :Boolean
Get the loaded flag.
Type:
- Boolean
- Overrides:
- Source:
magFilterType :ImageFilterType
Get/Set the mag filter type.
Type:
- Overrides:
- Source:
mappingType :ImageMappingType
Get/Set the mappingType type.
Type:
- Overrides:
- Source:
minFilterType :ImageFilterType
Get/Set the min filter type.
Type:
- Overrides:
- Source:
premultiplyAlpha :Boolean
Enable/Disable premultiply alpha.
Type:
- Boolean
- Overrides:
- Source:
src :String
Get source url or base64 data.
Type:
- String
- Source:
url :String
Get/Set url.
Type:
- String
- Overrides:
- Source:
uuid :String
Get the unique ID.
Type:
- String
- Overrides:
- Source:
width :Number
Get width in pixel.
Type:
- Number
- Source:
wrapType :ImageWrapType
Get/Set the wrapping behavior for the both S and T texture coordinates.
Type:
- Overrides:
- Source:
wrapTypeS :ImageWrapType
Get/Set the wrapping behavior for the S texture coordinate.
Type:
- Overrides:
- Source:
wrapTypeT :ImageWrapType
Get/Set the wrapping behavior for the T texture coordinate.
Type:
- Overrides:
- Source:
Methods
waitForComplete() → {Promise.<any>}
Wait for object load completed.
- Overrides:
- Source:
Returns:
- Type
- Promise.<any>