CubeMapFace

CubeMapFace

new

A face of a cube map (+x, -x, +y, -y, +z, or -z) that can be modified and rendered to.

See:
Source:

Methods

Copies texels from the source to the cubemap's face.

Parameters:
Name Type Argument Default Description
source Object The source ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement, or an object with a width, height, and typed array as shown in the example.
xOffset Number <optional>
0 An offset in the x direction in the cubemap where copying begins.
yOffset Number <optional>
0 An offset in the y direction in the cubemap where copying begins.
Throws:
Example
// Create a cubemap with 1x1 faces, and make the +x face red.
var cubeMap = context.createCubeMap({
  width : 1,
  height : 1
});
cubeMap.getPositiveX().copyFrom({
  width : 1,
  height : 1,
  arrayBufferView : new Uint8Array([255, 0, 0, 255])
});

Copies texels from the framebuffer to the cubemap's face.

Parameters:
Name Type Argument Default Description
xOffset Number <optional>
0 An offset in the x direction in the cubemap where copying begins.
yOffset Number <optional>
0 An offset in the y direction in the cubemap where copying begins.
framebufferXOffset Number <optional>
0 An offset in the x direction in the framebuffer where copying begins from.
framebufferYOffset Number <optional>
0 An offset in the y direction in the framebuffer where copying begins from.
width Number <optional>
CubeMap's width The width of the subimage to copy.
height Number <optional>
CubeMap's height The height of the subimage to copy.
Throws:
  • DeveloperError : Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT.
  • DeveloperError : This CubeMap was destroyed, i.e., destroy() was called.
  • DeveloperError : xOffset must be greater than or equal to zero.
  • DeveloperError : yOffset must be greater than or equal to zero.
  • DeveloperError : framebufferXOffset must be greater than or equal to zero.
  • DeveloperError : framebufferYOffset must be greater than or equal to zero.
  • DeveloperError : xOffset + source.width must be less than or equal to getWidth().
  • DeveloperError : yOffset + source.height must be less than or equal to getHeight().
  • DeveloperError : This CubeMap was destroyed, i.e., destroy() was called.
Example
// Copy the framebuffer contents to the +x cube map face.
cubeMap.getPositiveX().copyFromFramebuffer();

Returns the pixel data type of this cube map face. All faces in the same cube map have the same pixel data type.

Throws:
DeveloperError : This CubeMap was destroyed, i.e., destroy() was called.
Returns:
PixelFormat The pixel data type of this cubemap face.

Returns the pixel format of this cube map face. All faces in the same cube map have the same pixel format.

Throws:
DeveloperError : This CubeMap was destroyed, i.e., destroy() was called.
Returns:
PixelFormat The pixel format of this cubemap face.