[page:Object3D] →
[name]
Creates 6 cameras that render to a [page:WebGLRenderTargetCube].
Examples
[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]
[example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2 ]
[example:webgl_shading_physical shading / physical ]
// Create cube camera
var cubeCamera = new THREE.CubeCamera( 1, 100000, 128 );
scene.add( cubeCamera );
// Create car
var chromeMaterial = new THREE.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
[name]( [param:Number near], [param:Number far], [param:Number cubeResolution] )
near -- The near clipping distance.
far -- The far clipping distance
cubeResolution -- Sets the length of the cube's edges.
Constructs a CubeCamera that contains 6 [page:PerspectiveCamera PerspectiveCameras] that
render to a [page:WebGLRenderTargetCube].
Properties
See the base [page:Object3D] class for common properties.
[property:WebGLRenderTargetCube renderTarget]
The cube texture that gets generated.
Methods
See the base [page:Object3D] class for common methods.
[method:null update]( [param:WebGLRenderer renderer], [param:Scene scene] )
renderer -- The current WebGL renderer
scene -- The current scene
Call this to update the [page:CubeCamera.renderTarget renderTarget].
[method:null clear]( [param:WebGLRenderer renderer], [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )
Call this to clear the [page:CubeCamera.renderTarget renderTarget] color, depth, and/or stencil buffers.
The color buffer is set to the renderer's current clear color. Arguments default to *true*.
Source
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]