CubeCamera.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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], [param:Object options] )</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. <br />
  39. options - (optional) object that holds texture parameters passed to the auto-generated WebGLRenderTargetCube.
  40. If not specified, the options default to:
  41. <code>
  42. { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter }
  43. </code>
  44. </p>
  45. <p>
  46. Constructs a CubeCamera that contains 6 [page:PerspectiveCamera PerspectiveCameras] that
  47. render to a [page:WebGLRenderTargetCube].
  48. </p>
  49. <h2>Properties</h2>
  50. <p>See the base [page:Object3D] class for common properties.</p>
  51. <h3>[property:WebGLRenderTargetCube renderTarget]</h3>
  52. <p>
  53. The cube texture that gets generated.
  54. </p>
  55. <h2>Methods</h2>
  56. <p>See the base [page:Object3D] class for common methods.</p>
  57. <h3>[method:null update]( [param:WebGLRenderer renderer], [param:Scene scene] )</h3>
  58. <p>
  59. renderer -- The current WebGL renderer <br />
  60. scene -- The current scene
  61. </p>
  62. <p>
  63. Call this to update the [page:CubeCamera.renderTarget renderTarget].
  64. </p>
  65. <h3>[method:null clear]( [param:WebGLRenderer renderer], [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )</h3>
  66. <p>
  67. Call this to clear the [page:CubeCamera.renderTarget renderTarget] color, depth, and/or stencil buffers.
  68. The color buffer is set to the renderer's current clear color. Arguments default to *true*.
  69. </p>
  70. <h2>Source</h2>
  71. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  72. </body>
  73. </html>