CubeCamera.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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:WebGLCubeRenderTarget].</p>
  14. <h2>Code Example</h2>
  15. <code>// Create cube camera
  16. var cubeCamera = new THREE.CubeCamera( 1, 100000, 128 );
  17. scene.add( cubeCamera );
  18. // Create car
  19. var chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeCamera.renderTarget.texture } );
  20. var car = new Mesh( carGeometry, chromeMaterial );
  21. scene.add( car );
  22. // Update the render target cube
  23. car.setVisible( false );
  24. cubeCamera.position.copy( car.position );
  25. cubeCamera.update( renderer, scene );
  26. // Render the scene
  27. car.setVisible( true );
  28. renderer.render( scene, camera );
  29. </code>
  30. <h2>Examples</h2>
  31. <p>
  32. [example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]<br />
  33. [example:webgl_shading_physical shading / physical ]
  34. </p>
  35. <h2>Constructor</h2>
  36. <h3>[name]( [param:Number near], [param:Number far], [param:Number cubeResolution], [param:Object options] )</h3>
  37. <p>
  38. near -- The near clipping distance. <br />
  39. far -- The far clipping distance <br />
  40. cubeResolution -- Sets the length of the cube's edges. <br />
  41. options - (optional) object that holds texture parameters passed to the auto-generated WebGLCubeRenderTarget.
  42. If not specified, the options default to:
  43. <code>
  44. { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter }
  45. </code>
  46. </p>
  47. <p>
  48. Constructs a CubeCamera that contains 6 [page:PerspectiveCamera PerspectiveCameras] that
  49. render to a [page:WebGLCubeRenderTarget].
  50. </p>
  51. <h2>Properties</h2>
  52. <p>See the base [page:Object3D] class for common properties.</p>
  53. <h3>[property:WebGLCubeRenderTarget renderTarget]</h3>
  54. <p>
  55. The cube texture that gets generated.
  56. </p>
  57. <h2>Methods</h2>
  58. <p>See the base [page:Object3D] class for common methods.</p>
  59. <h3>[method:null update]( [param:WebGLRenderer renderer], [param:Scene scene] )</h3>
  60. <p>
  61. renderer -- The current WebGL renderer <br />
  62. scene -- The current scene
  63. </p>
  64. <p>
  65. Call this to update the [page:CubeCamera.renderTarget renderTarget].
  66. </p>
  67. <h3>[method:null clear]( [param:WebGLRenderer renderer], [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )</h3>
  68. <p>
  69. Call this to clear the [page:CubeCamera.renderTarget renderTarget] color, depth, and/or stencil buffers.
  70. The color buffer is set to the renderer's current clear color. Arguments default to *true*.
  71. </p>
  72. <h2>Source</h2>
  73. <p>
  74. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  75. </p>
  76. </body>
  77. </html>