Browse Source

Added docs for cameras.

alteredq 13 years ago
parent
commit
b536079eb1

+ 25 - 6
docs/api/cameras/Camera.rst

@@ -1,14 +1,33 @@
-Camera - Base class for camera types
-------------------------------------
+Camera - Abstract base class for cameras
+----------------------------------------
 
 .. rubric:: Constructor
 
 .. class:: Camera()
 
-    Base class for camera types
-    
+    Abstract base class for cameras
+
+    Inherits from :class:`Object3D`
+
+
 .. 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`

+ 52 - 5
docs/api/cameras/OrthographicCamera.rst

@@ -1,14 +1,61 @@
-OrthographicCamera - Camera using an orthographic projection
+OrthographicCamera - Camera with orthographic projection
 ------------------------------------------------------------
 
 .. 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
 
+.. 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:: Example(s)
+.. function:: OrthographicCamera.updateProjectionMatrix()
+
+    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 );

+ 97 - 6
docs/api/cameras/PerspectiveCamera.rst

@@ -1,14 +1,105 @@
-PerspectiveCamera - Camera using a perspective projection
+PerspectiveCamera - Camera with perspective projection
 ---------------------------------------------------------
 
 .. 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:: 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 );
+    scene.add( camera );

+ 21 - 18
docs/api/core/Color.rst

@@ -6,15 +6,16 @@ Color - Represents a color
 .. class:: Color(hex)
 
     Represents a color
-    
+
     :param integer hex: Hex value to intialize the color
 
+
 .. rubric:: Attributes
 
 .. attribute:: Color.r
 
     Red channel (float between 0 and 1)
-    
+
 .. attribute:: Color.g
 
     Green channel (float between 0 and 1)
@@ -23,6 +24,7 @@ Color - Represents a color
 
     Blue channel (float between 0 and 1)
 
+
 .. rubric:: Methods
 
 .. function:: Color.convertGammaToLinear()
@@ -36,29 +38,29 @@ Color - Represents a color
 .. function:: Color.copy(color)
 
     Copies the given color into this color
-    
+
     :param Color color: Color to copy
-    
+
 .. function:: Color.copyGammaToLinear(color)
 
     Creates a gamma color from a linear color
-    
+
     :param Color color: Color to copy
     :returns: Linear color
     :rtype: Color
-    
+
 .. function:: Color.copyLinearToGamma(color)
 
     Creates a linear color from a gamma color
-    
+
     :param Color color: Color to copy
     :returns: Gamma color
     :rtype: Color
-    
+
 .. function:: Color.setRGB(r, g, b)
 
     Sets the RGB value of this color
-    
+
     :param float r: Red 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)
@@ -67,40 +69,41 @@ Color - Represents a color
 
     Sets the HSV value of this color. Based on MochiKit implementation by
     Bob Ippolito.
-    
+
     :param float h: Hue channel (between 0 and 1)
     :param float s: Saturation channel (between 0 and 1)
     :param float v: Value channel (between 0 and 1)
-    
+
 .. function:: Color.setHex(hex)
 
     Sets the value of this color from a hex value
-    
+
     :param integer hex: Value of the color in hex
 
 .. function:: Color.getHex()
 
     Gets the value of this color in hex
-    
+
     :returns: The color value in hex
     :rtype: integer
-    
+
 .. function:: Color.getContextStyle()
 
     Returns the value of this color in CSS context style.
-    
+
     Example: ``rgb(r,g,b)``
-    
+
     :returns: A CSS-formatted color value
     :rtype: string
-    
+
 .. function:: Color.clone()
 
     Clones this color
-    
+
     :returns: New instance identical to this color
     :rtype: Color
 
+
 .. rubric:: Example
 
 ::

+ 2 - 0
docs/api/core/Face3.rst

@@ -16,6 +16,7 @@ Face3 - Triangle face
     :param varying color: face color or array of vertex colors
     :param integer materialIndex: material index
 
+
 .. rubric:: Attributes
 
 .. attribute:: Face3.a
@@ -62,6 +63,7 @@ Face3 - Triangle face
 
     Material index (points to ``geometry.materials`` array)
 
+
 .. rubric:: Example
 
 ::

+ 2 - 0
docs/api/core/Face4.rst

@@ -17,6 +17,7 @@ Face4 - Quad face
     :param varying color: face color or array of vertex colors
     :param integer materialIndex: material index
 
+
 .. rubric:: Attributes
 
 .. attribute:: Face4.a
@@ -67,6 +68,7 @@ Face4 - Quad face
 
     Material index (points to ``geometry.materials`` array)
 
+
 .. rubric:: Example
 
 ::

+ 4 - 0
docs/api/lights/AmbientLight.rst

@@ -7,10 +7,13 @@ AmbientLight - An ambient light
 
     An ambient light
 
+    Inherits from :class:`Light` :class:`Object3D`
+
     Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
 
     :param integer hex: light color
 
+
 .. rubric:: Attributes
 
 .. attribute:: AmbientLight.color
@@ -19,6 +22,7 @@ AmbientLight - An ambient light
 
     Material's ambient color gets multiplied by this color.
 
+
 .. rubric:: Example
 
 ::

+ 5 - 2
docs/api/lights/DirectionalLight.rst

@@ -7,14 +7,17 @@ DirectionalLight - A directional light
 
     A directional light
 
-    Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
-
     Part of scene graph
 
+    Inherits from :class:`Light` :class:`Object3D`
+
+    Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
+
     :param integer hex: light color
     :param float intensity: light intensity
     :param float distance: distance affected by light
 
+
 .. rubric:: Attributes
 
 .. attribute:: DirectionalLight.color

+ 3 - 0
docs/api/lights/Light.rst

@@ -7,8 +7,11 @@ Light - Abstract base class for lights
 
     Abstract base class for lights
 
+    Inherits from :class:`Object3D`
+
     :param integer hex: light color
 
+
 .. rubric:: Attributes
 
 .. attribute:: Light.color

+ 5 - 2
docs/api/lights/PointLight.rst

@@ -7,14 +7,17 @@ PointLight - A point light
 
     A point light
 
-    Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
-
     Part of scene graph
 
+    Inherits from :class:`Light` :class:`Object3D`
+
+    Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
+
     :param integer hex: light color
     :param float intensity: light intensity
     :param float distance: distance affected by light
 
+
 .. rubric:: Attributes
 
 .. attribute:: PointLight.color

+ 4 - 2
docs/api/lights/SpotLight.rst

@@ -7,10 +7,12 @@ SpotLight - A spotlight
 
     A point light that can cast shadow in one direction
 
-    Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
-
     Part of scene graph
 
+    Inherits from :class:`Light` :class:`Object3D`
+
+    Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
+
     :param integer hex: light color
     :param float intensity: light intensity
     :param float distance: distance affected by light