Object3D

CubeCamera

Creates 6 cameras that render to a WebGLRenderTargetCube.

Examples

materials / cubemap / dynamic

materials / cubemap / dynamic2

shading / physical

// Create cube camera var cubeCamera = new v3d.CubeCamera(1, 100000, 128); scene.add(cubeCamera); // Create car var chromeMaterial = new v3d.MeshLambertMaterial({ color: 0xffffff, envMap: cubeCamera.renderTarget }); var car = new Mesh(carGeometry, chromeMaterial); scene.add(car); // Update the render target cube car.setVisible(false); cubeCamera.position.copy(car.position); cubeCamera.update(renderer, scene); // Render the scene car.setVisible(true); renderer.render(scene, camera);

Constructor

CubeCamera(near : Number, far : Number, cubeResolution : Number, options : Object)

near -- The near clipping distance.
far -- The far clipping distance
cubeResolution -- Sets the length of the cube's edges.
options - (optional) object that holds texture parameters passed to the auto-generated WebGLRenderTargetCube. If not specified, the options default to: { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter }

Constructs a CubeCamera that contains 6 PerspectiveCameras that render to a WebGLRenderTargetCube.

Properties

See the base Object3D class for common properties.

.renderTarget : WebGLRenderTargetCube

The cube texture that gets generated.

Methods

See the base Object3D class for common methods.

.update (renderer : WebGLRenderer, scene : Scene) : null

renderer -- The current WebGL renderer
scene -- The current scene

Call this to update the renderTarget.

.clear (renderer : WebGLRenderer, color : Boolean, depth : Boolean, stencil : Boolean) : null

Call this to clear the renderTarget color, depth, and/or stencil buffers. The color buffer is set to the renderer's current clear color. Arguments default to true.

Source

For more info on how to obtain the source code of this module see this page.