Request

Response

    Autodesk.Viewing.Scene

    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

    typedescription
    string Optional name of this texture.

    setName(name)

    Parameters

    name*
    string
    Optional name of this texture.
    * Required

    getImage()

    Returns

    typedescription
    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

    typedescription
    Wrapping Horizontal (U) wrapping mode.

    setWrapS(wrapS)

    Parameters

    wrapS*
    Wrapping
    Horizontal (U) wrapping mode. Flags the texture for re-upload.
    * Required

    getWrapT()

    Returns

    typedescription
    Wrapping Vertical (V) wrapping mode.

    setWrapT(wrapT)

    Parameters

    wrapT*
    Wrapping
    Vertical (V) wrapping mode. Flags the texture for re-upload.
    * Required

    getMagFilter()

    Returns

    typedescription
    Filter Magnification filter.

    setMagFilter(magFilter)

    Parameters

    magFilter*
    Filter
    Magnification filter. Flags the texture for re-upload.
    * Required

    getMinFilter()

    Returns

    typedescription
    Filter Minification filter.

    setMinFilter(minFilter)

    Parameters

    minFilter*
    Filter
    Minification filter. Flags the texture for re-upload.
    * Required

    getOffset()

    Returns

    typedescription
    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

    typedescription
    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

    textureTexture to copy into. A new texture is created if omitted.

    Returns

    typedescription
    Texture The target texture.

    dispose()

    Releases GPU resources held by this texture by dispatching a dispose event.