PerspectiveCamera.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. PerspectiveCamera - Camera with perspective projection
  2. ---------------------------------------------------------
  3. .. rubric:: Constructor
  4. .. class:: PerspectiveCamera( fov, aspect, near, far )
  5. Camera with perspective projection
  6. Part of scene graph
  7. Inherits from :class:`Object3D` :class:`Camera`
  8. :param float fov: field of view
  9. :param float aspect: aspect
  10. :param float near: near
  11. :param float far: far
  12. .. rubric:: Attributes
  13. .. attribute:: PerspectiveCamera.fov
  14. Camera frustum vertical field of view
  15. .. attribute:: PerspectiveCamera.aspect
  16. Camera frustum aspect
  17. .. attribute:: PerspectiveCamera.near
  18. Camera frustum near plane
  19. .. attribute:: PerspectiveCamera.far
  20. Camera frustum far plane
  21. .. rubric:: Multi-view attributes
  22. .. attribute:: PerspectiveCamera.fullWidth
  23. .. attribute:: PerspectiveCamera.fullHeight
  24. .. attribute:: PerspectiveCamera.x
  25. .. attribute:: PerspectiveCamera.y
  26. .. attribute:: PerspectiveCamera.width
  27. .. attribute:: PerspectiveCamera.height
  28. .. rubric:: Methods
  29. .. function:: PerspectiveCamera.updateProjectionMatrix()
  30. Updated camera's projection matrix. Must be called after change of parameters.
  31. .. function:: PerspectiveCamera.setLens ( focalLength, frameSize )
  32. Uses focal length (in mm) to estimate and set FOV
  33. 35mm (fullframe) camera is used if frame size is not specified.
  34. Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
  35. :param float focalLength: focal length
  36. :param float frameSize: frame size
  37. .. function:: PerspectiveCamera.setViewOffset ( fullWidth, fullHeight, x, y, width, height )
  38. Sets an offset in a larger frustum. This is useful for multi-window or
  39. multi-monitor/multi-machine setups.
  40. For example, if you have 3x2 monitors and each monitor is 1920x1080 and
  41. the monitors are in grid like this:
  42. +---+---+---+
  43. | A | B | C |
  44. +---+---+---+
  45. | D | E | F |
  46. +---+---+---+
  47. then for each monitor you would call it like this:
  48. ::
  49. var w = 1920;
  50. var h = 1080;
  51. var fullWidth = w * 3;
  52. var fullHeight = h * 2;
  53. // --A--
  54. camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
  55. //--B--
  56. camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
  57. //--C--
  58. camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
  59. //--D--
  60. camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
  61. //--E--
  62. camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
  63. //--F--
  64. camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
  65. Note there is no reason monitors have to be the same size or in a grid.
  66. :param float fullWidth: full width of multi-view setup
  67. :param float fullHeight: full height of multi-view setup
  68. :param float x: x-offset of subcamera
  69. :param float y: y-offset of subcamera
  70. :param float width: width of subcamera
  71. :param float height: height of subcamera
  72. .. rubric:: Example
  73. ::
  74. var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
  75. scene.add( camera );