提交 b536079e 编写于 作者: A alteredq

Added docs for cameras.

上级 0f13495f
Camera - Base class for camera types Camera - Abstract base class for cameras
------------------------------------ ----------------------------------------
.. rubric:: Constructor .. rubric:: Constructor
.. class:: Camera() .. class:: Camera()
Base class for camera types Abstract base class for cameras
Inherits from :class:`Object3D`
.. rubric:: Attributes .. rubric:: Attributes
.. rubric:: Method .. attribute:: Camera.matrixWorldInverse
:class:`Matrix4`
.. attribute:: Camera.projectionMatrix
:class:`Matrix4`
.. attribute:: Camera.projectionMatrixInverse
:class:`Matrix4`
.. rubric:: Methods
.. function:: Camera.lookAt( vector )
.. rubric:: Example(s) Orient camera to look at :class:`Vector3`
\ No newline at end of file \ No newline at end of file
OrthographicCamera - Camera using an orthographic projection OrthographicCamera - Camera with orthographic projection
------------------------------------------------------------ ------------------------------------------------------------
.. rubric:: Constructor .. rubric:: Constructor
.. class:: OrthographicCamera() .. class:: OrthographicCamera( left, right, top, bottom, near, far )
Camera with orthographic projection
Part of scene graph
Inherits from :class:`Object3D` :class:`Camera`
:param float left: left
:param float right: right
:param float top: top
:param float bottom: bottom
:param float near: near
:param float far: far
Camera using an orthographic projection
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: OrthographicCamera.left
Camera frustum left plane
.. attribute:: OrthographicCamera.right
Camera frustum right plane
.. attribute:: OrthographicCamera.top
Camera frustum top plane
.. attribute:: OrthographicCamera.bottom
Camera frustum bottom plane
.. attribute:: OrthographicCamera.near
Camera frustum near plane
.. attribute:: OrthographicCamera.far
Camera frustum far plane
.. rubric:: Method .. rubric:: Method
.. rubric:: Example(s) .. function:: OrthographicCamera.updateProjectionMatrix()
\ No newline at end of file
Updated camera's projection matrix. Must be called after change of parameters.
.. rubric:: Example
::
var camera = new THREE.OrthographicCamera( window.innerWidth / - 2, window.innerWidth / 2, window.innerHeight / 2, window.innerHeight / - 2, 1, 1000 );
scene.add( camera );
PerspectiveCamera - Camera using a perspective projection PerspectiveCamera - Camera with perspective projection
--------------------------------------------------------- ---------------------------------------------------------
.. rubric:: Constructor .. rubric:: Constructor
.. class:: PerspectiveCamera() .. class:: PerspectiveCamera( fov, aspect, near, far )
Camera with perspective projection
Part of scene graph
Inherits from :class:`Object3D` :class:`Camera`
:param float fov: field of view
:param float aspect: aspect
:param float near: near
:param float far: far
Camera using a perspective projection
.. rubric:: Attributes .. rubric:: Attributes
.. rubric:: Method .. attribute:: PerspectiveCamera.fov
Camera frustum vertical field of view
.. attribute:: PerspectiveCamera.aspect
Camera frustum aspect
.. attribute:: PerspectiveCamera.near
Camera frustum near plane
.. attribute:: PerspectiveCamera.far
Camera frustum far plane
.. rubric:: Multi-view attributes
.. attribute:: PerspectiveCamera.fullWidth
.. attribute:: PerspectiveCamera.fullHeight
.. attribute:: PerspectiveCamera.x
.. attribute:: PerspectiveCamera.y
.. attribute:: PerspectiveCamera.width
.. attribute:: PerspectiveCamera.height
.. rubric:: Methods
.. function:: PerspectiveCamera.updateProjectionMatrix()
Updated camera's projection matrix. Must be called after change of parameters.
.. function:: PerspectiveCamera.setLens ( focalLength, frameSize )
Uses Focal Length (in mm) to estimate and set FOV
35mm (fullframe) camera is used if frame size is not specified;
Formula based on http://www.bobatkins.com/photography/technical/field_of_view.html
.. function:: PerspectiveCamera.setViewOffset ( fullWidth, fullHeight, x, y, width, height )
Sets an offset in a larger frustum. This is useful for multi-window or
multi-monitor/multi-machine setups.
For example, if you have 3x2 monitors and each monitor is 1920x1080 and
the monitors are in grid like this:
+---+---+---+
| A | B | C |
+---+---+---+
| D | E | F |
+---+---+---+
then for each monitor you would call it like this:
::
var w = 1920;
var h = 1080;
var fullWidth = w * 3;
var fullHeight = h * 2;
// --A--
camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
//--B--
camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
//--C--
camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
//--D--
camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
//--E--
camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
//--F--
camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
Note there is no reason monitors have to be the same size or in a grid.
.. rubric:: Example
::
.. rubric:: Example(s) var camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
\ No newline at end of file scene.add( camera );
...@@ -6,15 +6,16 @@ Color - Represents a color ...@@ -6,15 +6,16 @@ Color - Represents a color
.. class:: Color(hex) .. class:: Color(hex)
Represents a color Represents a color
:param integer hex: Hex value to intialize the color :param integer hex: Hex value to intialize the color
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: Color.r .. attribute:: Color.r
Red channel (float between 0 and 1) Red channel (float between 0 and 1)
.. attribute:: Color.g .. attribute:: Color.g
Green channel (float between 0 and 1) Green channel (float between 0 and 1)
...@@ -23,6 +24,7 @@ Color - Represents a color ...@@ -23,6 +24,7 @@ Color - Represents a color
Blue channel (float between 0 and 1) Blue channel (float between 0 and 1)
.. rubric:: Methods .. rubric:: Methods
.. function:: Color.convertGammaToLinear() .. function:: Color.convertGammaToLinear()
...@@ -36,29 +38,29 @@ Color - Represents a color ...@@ -36,29 +38,29 @@ Color - Represents a color
.. function:: Color.copy(color) .. function:: Color.copy(color)
Copies the given color into this color Copies the given color into this color
:param Color color: Color to copy :param Color color: Color to copy
.. function:: Color.copyGammaToLinear(color) .. function:: Color.copyGammaToLinear(color)
Creates a gamma color from a linear color Creates a gamma color from a linear color
:param Color color: Color to copy :param Color color: Color to copy
:returns: Linear color :returns: Linear color
:rtype: Color :rtype: Color
.. function:: Color.copyLinearToGamma(color) .. function:: Color.copyLinearToGamma(color)
Creates a linear color from a gamma color Creates a linear color from a gamma color
:param Color color: Color to copy :param Color color: Color to copy
:returns: Gamma color :returns: Gamma color
:rtype: Color :rtype: Color
.. function:: Color.setRGB(r, g, b) .. function:: Color.setRGB(r, g, b)
Sets the RGB value of this color Sets the RGB value of this color
:param float r: Red channel value (between 0 and 1) :param float r: Red channel value (between 0 and 1)
:param float g: Green channel value (between 0 and 1) :param float g: Green channel value (between 0 and 1)
:param float b: Blue channel value (between 0 and 1) :param float b: Blue channel value (between 0 and 1)
...@@ -67,40 +69,41 @@ Color - Represents a color ...@@ -67,40 +69,41 @@ Color - Represents a color
Sets the HSV value of this color. Based on MochiKit implementation by Sets the HSV value of this color. Based on MochiKit implementation by
Bob Ippolito. Bob Ippolito.
:param float h: Hue channel (between 0 and 1) :param float h: Hue channel (between 0 and 1)
:param float s: Saturation channel (between 0 and 1) :param float s: Saturation channel (between 0 and 1)
:param float v: Value channel (between 0 and 1) :param float v: Value channel (between 0 and 1)
.. function:: Color.setHex(hex) .. function:: Color.setHex(hex)
Sets the value of this color from a hex value Sets the value of this color from a hex value
:param integer hex: Value of the color in hex :param integer hex: Value of the color in hex
.. function:: Color.getHex() .. function:: Color.getHex()
Gets the value of this color in hex Gets the value of this color in hex
:returns: The color value in hex :returns: The color value in hex
:rtype: integer :rtype: integer
.. function:: Color.getContextStyle() .. function:: Color.getContextStyle()
Returns the value of this color in CSS context style. Returns the value of this color in CSS context style.
Example: ``rgb(r,g,b)`` Example: ``rgb(r,g,b)``
:returns: A CSS-formatted color value :returns: A CSS-formatted color value
:rtype: string :rtype: string
.. function:: Color.clone() .. function:: Color.clone()
Clones this color Clones this color
:returns: New instance identical to this color :returns: New instance identical to this color
:rtype: Color :rtype: Color
.. rubric:: Example .. rubric:: Example
:: ::
......
...@@ -16,6 +16,7 @@ Face3 - Triangle face ...@@ -16,6 +16,7 @@ Face3 - Triangle face
:param varying color: face color or array of vertex colors :param varying color: face color or array of vertex colors
:param integer materialIndex: material index :param integer materialIndex: material index
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: Face3.a .. attribute:: Face3.a
...@@ -62,6 +63,7 @@ Face3 - Triangle face ...@@ -62,6 +63,7 @@ Face3 - Triangle face
Material index (points to ``geometry.materials`` array) Material index (points to ``geometry.materials`` array)
.. rubric:: Example .. rubric:: Example
:: ::
......
...@@ -17,6 +17,7 @@ Face4 - Quad face ...@@ -17,6 +17,7 @@ Face4 - Quad face
:param varying color: face color or array of vertex colors :param varying color: face color or array of vertex colors
:param integer materialIndex: material index :param integer materialIndex: material index
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: Face4.a .. attribute:: Face4.a
...@@ -67,6 +68,7 @@ Face4 - Quad face ...@@ -67,6 +68,7 @@ Face4 - Quad face
Material index (points to ``geometry.materials`` array) Material index (points to ``geometry.materials`` array)
.. rubric:: Example .. rubric:: Example
:: ::
......
...@@ -7,10 +7,13 @@ AmbientLight - An ambient light ...@@ -7,10 +7,13 @@ AmbientLight - An ambient light
An ambient light An ambient light
Inherits from :class:`Light` :class:`Object3D`
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial` Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
:param integer hex: light color :param integer hex: light color
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: AmbientLight.color .. attribute:: AmbientLight.color
...@@ -19,6 +22,7 @@ AmbientLight - An ambient light ...@@ -19,6 +22,7 @@ AmbientLight - An ambient light
Material's ambient color gets multiplied by this color. Material's ambient color gets multiplied by this color.
.. rubric:: Example .. rubric:: Example
:: ::
......
...@@ -7,14 +7,17 @@ DirectionalLight - A directional light ...@@ -7,14 +7,17 @@ DirectionalLight - A directional light
A directional light A directional light
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
Part of scene graph Part of scene graph
Inherits from :class:`Light` :class:`Object3D`
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
:param integer hex: light color :param integer hex: light color
:param float intensity: light intensity :param float intensity: light intensity
:param float distance: distance affected by light :param float distance: distance affected by light
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: DirectionalLight.color .. attribute:: DirectionalLight.color
......
...@@ -7,8 +7,11 @@ Light - Abstract base class for lights ...@@ -7,8 +7,11 @@ Light - Abstract base class for lights
Abstract base class for lights Abstract base class for lights
Inherits from :class:`Object3D`
:param integer hex: light color :param integer hex: light color
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: Light.color .. attribute:: Light.color
......
...@@ -7,14 +7,17 @@ PointLight - A point light ...@@ -7,14 +7,17 @@ PointLight - A point light
A point light A point light
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
Part of scene graph Part of scene graph
Inherits from :class:`Light` :class:`Object3D`
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
:param integer hex: light color :param integer hex: light color
:param float intensity: light intensity :param float intensity: light intensity
:param float distance: distance affected by light :param float distance: distance affected by light
.. rubric:: Attributes .. rubric:: Attributes
.. attribute:: PointLight.color .. attribute:: PointLight.color
......
...@@ -7,10 +7,12 @@ SpotLight - A spotlight ...@@ -7,10 +7,12 @@ SpotLight - A spotlight
A point light that can cast shadow in one direction A point light that can cast shadow in one direction
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
Part of scene graph Part of scene graph
Inherits from :class:`Light` :class:`Object3D`
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
:param integer hex: light color :param integer hex: light color
:param float intensity: light intensity :param float intensity: light intensity
:param float distance: distance affected by light :param float distance: distance affected by light
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册