CubeMapFace

new SuperMap3D.CubeMapFace()

Methods

copyFrom(source, xOffset, yOffset)

Copies texels from the source to the cubemap's face.
Name Type 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 0 optional An offset in the x direction in the cubemap where copying begins.
yOffset Number 0 optional An offset in the y direction in the cubemap where copying begins.
Throws:
  • DeveloperError : xOffset must be greater than or equal to zero.
  • DeveloperError : yOffset must be greater than or equal to zero.
  • DeveloperError : xOffset + source.width must be less than or equal to width.
  • DeveloperError : yOffset + source.height must be less than or equal to height.
  • DeveloperError : This CubeMap was destroyed, i.e., destroy() was called.
Example:
// Create a cubemap with 1x1 faces, and make the +x face red.
var cubeMap = new CubeMap({
  context : context
  width : 1,
  height : 1
});
cubeMap.positiveX.copyFrom({
  width : 1,
  height : 1,
  arrayBufferView : new Uint8Array([255, 0, 0, 255])
});

copyFromFramebuffer(xOffset, yOffset, framebufferXOffset, framebufferYOffset, width, height)

Copies texels from the framebuffer to the cubemap's face.
Name Type Default Description
xOffset Number 0 optional An offset in the x direction in the cubemap where copying begins.
yOffset Number 0 optional An offset in the y direction in the cubemap where copying begins.
framebufferXOffset Number 0 optional An offset in the x direction in the framebuffer where copying begins from.
framebufferYOffset Number 0 optional An offset in the y direction in the framebuffer where copying begins from.
width Number CubeMap's width optional The width of the subimage to copy.
height Number CubeMap's height optional 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 width.
  • DeveloperError : yOffset + source.height must be less than or equal to height.
  • DeveloperError : This CubeMap was destroyed, i.e., destroy() was called.
Example:
// Copy the framebuffer contents to the +x cube map face.
cubeMap.positiveX.copyFromFramebuffer();