Class JSC3D.Texture
Texture
This class implements texture which describes the surface details for a mesh.
Defined in: jsc3d.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JSC3D.Texture(name, onready)
|
Field Attributes | Field Name and Description |
---|---|
Whether the texture contains tranparent pixels.
|
|
Height of the texture in pixels.
|
|
Name of the texture.
|
|
A callback function that will be invoked immediately as the texture is ready.
|
|
URL of the image source of the texture.
|
|
Width of the texture in pixels.
|
Method Attributes | Method Name and Description |
---|---|
createFromImage(image, useMipmap)
Extract texture data from an exsisting image.
|
|
createFromUrl(imageUrl, useMipmap)
Load an image and extract texture data from it.
|
|
Generate mip-map pyramid for the texture.
|
|
hasData()
See if this texture contains texel data.
|
|
See if this texture has mip-maps.
|
Field Detail
hasTransparency
Whether the texture contains tranparent pixels. Read only.
height
Height of the texture in pixels. Read only.
name
Name of the texture.
onready
A callback function that will be invoked immediately as the texture is ready.
srcUrl
URL of the image source of the texture. Read only.
width
Width of the texture in pixels. Read only.
Method Detail
createFromImage(image, useMipmap)
Extract texture data from an exsisting image.
- Parameters:
- {Image} image
- image as datasource of the texture.
- {Boolean} useMipmap
- set true to generate mip-maps; false(default) not to generate mip-maps.
createFromUrl(imageUrl, useMipmap)
Load an image and extract texture data from it.
- Parameters:
- {String} imageUrl
- where to load the image.
- {Boolean} useMipmap
- set true to generate mip-maps; false(default) not to generate mip-maps.
generateMipmaps()
Generate mip-map pyramid for the texture.
{Boolean}
hasData()
See if this texture contains texel data.
- Returns:
- {Boolean} true if it has texel data; false if not.
{Boolean}
hasMipmap()
See if this texture has mip-maps.
- Returns:
- {Boolean} true if it has mip-maps; false if not.