CubeCamera.html 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Object3D] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">Creates 6 cameras that render to a [page:WebGLRenderTargetCube].</p>
  14. <h2>Examples</h2>
  15. <p>[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]</p>
  16. <p>[example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2 ]</p>
  17. <p>[example:webgl_shading_physical shading / physical ]</p>
  18. <code>// Create cube camera
  19. var cubeCamera = new THREE.CubeCamera( 1, 100000, 128 );
  20. scene.add( cubeCamera );
  21. // Create car
  22. var chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeCamera.renderTarget } );
  23. var car = new Mesh( carGeometry, chromeMaterial );
  24. scene.add( car );
  25. // Update the render target cube
  26. car.setVisible( false );
  27. cubeCamera.position.copy( car.position );
  28. cubeCamera.update( renderer, scene );
  29. // Render the scene
  30. car.setVisible( true );
  31. renderer.render( scene, camera );
  32. </code>
  33. <h2>Constructor</h2>
  34. <h3>[name]( [param:Number near], [param:Number far], [param:Number cubeResolution] )</h3>
  35. <p>
  36. near -- The near clipping distance. <br />
  37. far -- The far clipping distance <br />
  38. cubeResolution -- Sets the length of the cube's edges.
  39. </p>
  40. <p>
  41. Constructs a CubeCamera that contains 6 [page:PerspectiveCamera PerspectiveCameras] that
  42. render to a [page:WebGLRenderTargetCube].
  43. </p>
  44. <h2>Properties</h2>
  45. <p>See the base [page:Object3D] class for common properties.</p>
  46. <h3>[property:WebGLRenderTargetCube renderTarget]</h3>
  47. <p>
  48. The cube texture that gets generated.
  49. </p>
  50. <h2>Methods</h2>
  51. <p>See the base [page:Object3D] class for common methods.</p>
  52. <h3>[method:null update]( [param:WebGLRenderer renderer], [param:Scene scene] )</h3>
  53. <p>
  54. renderer -- The current WebGL renderer <br />
  55. scene -- The current scene
  56. </p>
  57. <p>
  58. Call this to update the [page:CubeCamera.renderTarget renderTarget].
  59. </p>
  60. <h3>[method:null clear]( [param:WebGLRenderer renderer], [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )</h3>
  61. <p>
  62. Call this to clear the [page:CubeCamera.renderTarget renderTarget] color, depth, and/or stencil buffers.
  63. The color buffer is set to the renderer's current clear color. Arguments default to *true*.
  64. </p>
  65. <h2>Source</h2>
  66. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  67. </body>
  68. </html>