API Documentation

for 0.0.1
Show:

Texture Class

Texture are bitmap pictures loaded in the graphic card memory so they can be mapped on a geometry surface. Usually, texture are mapped through a Material. Keep in mind that WebGL, as an impletation of OpenGL, shares the same kind of limitations : textures sources should be power of 2 (even if here, Three.js is doing the job of resizing for you if they're not). Constants list for possible texture's mapping mode :

Texture.UVMapping Texture.CubeReflectionMapping Texture.CubeRefractionMapping Texture.EquirectangularReflectionMapping Texture.EquirectangularRefractionMapping Texture.SphericalReflectionMapping Texture.CubeUVReflectionMapping Texture.CubeUVRefractionMapping

Constructor

Texture

(
  • params
)

Parameters:

  • params Object
    • image Context

      the Image object.

    • canvas String

      the canvas object url.

Methods

dispose

()

Clears the underlying Three.js texture object

fromCanvas

(
  • canvas
)

Create the texture from a Canvas DOM element (can be Mobilizing itself -> when we'll can catch a WebGL canvas pixels...)

Parameters:

  • canvas Canvas

    canvas

fromImage

(
  • image
)

Create the texture from an image file

Parameters:

  • image Image

    tells if the loader should force the main process to wait for the end of

setNeedsUpdate

(
  • val
)

Set this to true to trigger an update next time the texture is used. Particularly important for setting the wrap mode.

Parameters:

  • val Boolean

setPremultiplyAlpha

(
  • val
)

False by default, which is the norm for PNG images. Set to true if the RGB values have been stored premultiplied by alpha.

Parameters:

  • val Boolean

setRepeat

(
  • u
  • v
)

Define the repetition factor of this texture. If the value is > 1, then the texture will be mapped twice on the surface and so on. NB: usage of this method automatically sets the wrapS and wrapT properties to RepeatWrapping

Parameters:

  • u Float

    the new u texture coordinate repetition to use

  • v Float

    the new u texture coordinate repetition to use

undefined

(
  • val
)

How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is 0.0 to 1.0.

Parameters:

  • val Numbe

    offset between 0.0 to 1.0

Properties

setMapping

Unknown

How the image is applied to the object. An object type of Texture.UVMapping is the default, where the U,V coordinates are used to apply the map.

Sub-properties:

  • mapping Number