CubeCamera.html 2.8 KB

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