Autodesk.Viewing.Scene
Version 8 preview
This page documents a preview of the Viewer SDK v8. APIs and content can still change before the final release.
Texture
new Texture(image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy)
Represents a texture: image data together with the sampling, wrapping and mapping parameters used when it is applied to a material.
The numeric mapping, wrapS/wrapT, magFilter/minFilter, format and type parameters take the corresponding texture constants.
Parameters
| image Object | Image data for the texture (e.g. an HTMLImageElement, HTMLCanvasElement or HTMLVideoElement). |
| mapping Mapping | How the texture is mapped to the surface. Default: UV mapping. |
| wrapS Wrapping | Horizontal (U) wrapping mode. Default: clamp to edge. |
| wrapT Wrapping | Vertical (V) wrapping mode. Default: clamp to edge. |
| magFilter Filter | Magnification filter. Default: linear. |
| minFilter Filter | Minification filter. Default: linear mip-map linear. |
| format TextureFormat | Pixel format. Default: RGBA. |
| type TextureType | Pixel data type. Default: unsigned byte. |
| anisotropy number | Number of samples taken along the axis of highest anisotropy. Default: 1. |
Methods
getName()
Returns
| type | description |
|---|---|
| string | Optional name of this texture. |
setName(name)
Parameters
| name* string | Optional name of this texture. |
* Required
getImage()
Returns
| type | description |
|---|---|
| Object | Image data for the texture. |
setImage(image)
Parameters
| image* Object | Image data for the texture. Flags the texture for re-upload. |
* Required
getWrapS()
Returns
| type | description |
|---|---|
| Wrapping | Horizontal (U) wrapping mode. |
setWrapS(wrapS)
Parameters
| wrapS* Wrapping | Horizontal (U) wrapping mode. Flags the texture for re-upload. |
* Required
getWrapT()
Returns
| type | description |
|---|---|
| Wrapping | Vertical (V) wrapping mode. |
setWrapT(wrapT)
Parameters
| wrapT* Wrapping | Vertical (V) wrapping mode. Flags the texture for re-upload. |
* Required
getMagFilter()
Returns
| type | description |
|---|---|
| Filter | Magnification filter. |
setMagFilter(magFilter)
Parameters
| magFilter* Filter | Magnification filter. Flags the texture for re-upload. |
* Required
getMinFilter()
Returns
| type | description |
|---|---|
| Filter | Minification filter. |
setMinFilter(minFilter)
Parameters
| minFilter* Filter | Minification filter. Flags the texture for re-upload. |
* Required
getOffset()
Returns
| type | description |
|---|---|
| Vector2 | A defensive clone of how many times the texture is offset, in each direction. |
setOffset(offset)
Parameters
| offset* | How many times the texture is offset, in each direction. Copied into the existing Vector2. Flags the texture for re-upload. |
* Required
getRepeat()
Returns
| type | description |
|---|---|
| Vector2 | A defensive clone of how many times the texture is repeated, in each direction. |
setRepeat(repeat)
Parameters
| repeat* | How many times the texture is repeated, in each direction. Copied into the existing Vector2. Flags the texture for re-upload. |
* Required
clone(texture)
Copies this texture’s properties into the given texture.
Parameters
| texture | Texture to copy into. A new texture is created if omitted. |
Returns
| type | description |
|---|---|
| Texture | The target texture. |
dispose()
Releases GPU resources held by this texture by dispatching a dispose event.