PerspectiveCamera.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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; [page:Camera] &rarr;
  12. <h1>[name]</h1>
  13. <div class="desc">Camera with perspective projection.</div>
  14. <h2>Example</h2>
  15. <div>[example:canvas_effects_stereo effects / stereo ]</div>
  16. <div>[example:canvas_geometry_birds geometry / birds ]</div>
  17. <div>[example:canvas_geometry_cube geometry / cube ]</div>
  18. <div>[example:webgl_animation_skinning_blending animation / skinning / blending ]</div>
  19. <div>[example:webgl_animation_skinning_morph animation / skinning / blending ]</div>
  20. <div>[example:webgl_interactive_cubes interactive / cubes ]</div>
  21. <div>[example:webgl_loader_collada_skinning loader / collada / skinning ]</div>
  22. <code>var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
  23. scene.add( camera );</code>
  24. <h2>Constructor</h2>
  25. <h3>[name]( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )</h3>
  26. <div>
  27. fov — Camera frustum vertical field of view.<br />
  28. aspect — Camera frustum aspect ratio.<br />
  29. near — Camera frustum near plane.<br />
  30. far — Camera frustum far plane.
  31. </div>
  32. <h2>Properties</h2>
  33. <h3>[property:number zoom]</h3>
  34. <div>Gets or sets the zoom factor of the camera. </div>
  35. <h3>[property:Float fov]</h3>
  36. <div>Camera frustum vertical field of view, from bottom to top of view, in degrees.</div>
  37. <h3>[property:Float aspect]</h3>
  38. <div>Camera frustum aspect ratio, window width divided by window height.</div>
  39. <h3>[property:Float near]</h3>
  40. <div>Camera frustum near plane.</div>
  41. <h3>[property:Float far]</h3>
  42. <div>Camera frustum far plane.</div>
  43. <h2>Methods</h2>
  44. <h3>[method:null setLens]( [page:Float focalLength], [page:Float frameSize] )</h3>
  45. <div>
  46. focalLength — focal length<br />
  47. frameSize — frame size
  48. </div>
  49. <div>
  50. Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified.<br />
  51. Formula based on [link:http://www.bobatkins.com/photography/technical/field_of_view.html]
  52. </div>
  53. <h3>[method:null setViewOffset]( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )</h3>
  54. <div>
  55. fullWidth — full width of multiview setup<br />
  56. fullHeight — full height of multiview setup<br />
  57. x — horizontal offset of subcamera<br />
  58. y — vertical offset of subcamera<br />
  59. width — width of subcamera<br />
  60. height — height of subcamera
  61. </div>
  62. <div>
  63. Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
  64. </div>
  65. <div>
  66. For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:<br />
  67. <pre>+---+---+---+
  68. | A | B | C |
  69. +---+---+---+
  70. | D | E | F |
  71. +---+---+---+</pre>
  72. then for each monitor you would call it like this:<br />
  73. <code>var w = 1920;
  74. var h = 1080;
  75. var fullWidth = w * 3;
  76. var fullHeight = h * 2;
  77. // A
  78. camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
  79. // B
  80. camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
  81. // C
  82. camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
  83. // D
  84. camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
  85. // E
  86. camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
  87. // F
  88. camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
  89. </code>
  90. Note there is no reason monitors have to be the same size or in a grid.
  91. </div>
  92. <h3>[method:null updateProjectionMatrix]()</h3>
  93. <div>
  94. Updates the camera projection matrix. Must be called after change of parameters.
  95. </div>
  96. <h3>[method:PerspectiveCamera clone]()</h3>
  97. <div>
  98. <br />
  99. It returns a clone of PerspectiveCamera.
  100. </div>
  101. <h3>[method:JSON toJSON]()</h3>
  102. <div>
  103. Return camera data in JSON format.
  104. </div>
  105. <h2>Source</h2>
  106. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  107. </body>
  108. </html>