CubeTexture Class

Extends Texture
Module: Textures

CubeTextures represent 360 view using six images, these images correspond to the faces of a cube.

CubeTextures can be used to simulate reflections and transparency refraction in materials.

Is also possible to create dynamic cubetextures using the CubeCamera object.

Methods

renderEquirectFace

(
  • read
  • face
  • rotation
  • size
)
ImageData

Render a cube face from equirectangular projection.

Parameters:

  • read ImageData

    Equirectangular image.

  • face Number

    Face to render.

  • rotation Number

    Image rotation

  • size Number

    Face size.

Returns:

ImageData:

Face data.

resampleBilinear

(
  • read
  • write
  • x
  • y
  • index
)

Resample an image pixel from ImageData to ImageData, using bilinear interpolation.

Parameters:

  • read ImageData

    Where to read data from.

  • write ImageData

    Where to write data.

  • x Number

    Origin pixel x.

  • y Number

    Origin pixel y.

  • index Number

    Target index.

setImages

(
  • images
  • mode
)

Set new images for this cube texture.

Parameters:

  • images Array

    Cube texture images.

  • mode Number

    Mode to be used.

setSize

(
  • size
)

Set resolution of each face of the cubemap.

The size has to be a power of 2.

Parameters:

  • size Number

    Cube face resolution.

toJSON

(
  • meta
)
Object

Serialize cube texture to JSON.

All images of the cube texture are stored individually.

Parameters:

  • meta Object

Returns:

Object:

json

updateImages

()

Updates the CubeTexture images, should be called after changing the images attached to the texture

Properties

mode

Number

Cube texture mode, the mode specifies how the cube texture is created.

Source format may vary from a mode to another.

size

Number

Size of each one of the texture that compose the CubeTexture.

Default: 512

Attributes

BACK

Number

Cubemap back image index

BOTTOM

Number

Cubemap bottom image index

CROSS

Number

CubeMap mode, single image used as source.

CUBE

Number

CubeMap mode, 6 images used as source for the texture.

EQUIRECTANGULAR

Number

Equirectangular projection mode, 1 single image used as source.

Source image should have a 2:1 aspect ratio.

FRONT

Number

Cubemap front image index

LEFT

Number

Cubemap left image index

RIGHT

Number

Cubemap right image index

TOP

Number

Cubemap top image index