Pārlūkot izejas kodu

Added stubs for cameras and lights and fully documented Color

Jeff Terrace 13 gadi atpakaļ
vecāks
revīzija
c88aec362f

+ 2 - 0
doc/api/THREE.rst

@@ -2,7 +2,9 @@ THREE - Main three.js namespace
 ===============================
 
 .. toctree::
+    cameras/index.rst
     core/index.rst
+    lights/index.rst
 
 .. js:data:: THREE
 

+ 7 - 0
doc/api/cameras/Camera.rst

@@ -0,0 +1,7 @@
+Camera - Base class for camera types
+------------------------------------
+
+.. js:class:: Camera()
+
+    Base class for camera types
+    

+ 7 - 0
doc/api/cameras/OrthographicCamera.rst

@@ -0,0 +1,7 @@
+OrthographicCamera - Camera using an orthographic projection
+------------------------------------------------------------
+
+.. js:class:: OrthographicCamera()
+
+    Camera using an orthographic projection
+    

+ 7 - 0
doc/api/cameras/PerspectiveCamera.rst

@@ -0,0 +1,7 @@
+PerspectiveCamera - Camera using a perspective projection
+---------------------------------------------------------
+
+.. js:class:: PerspectiveCamera()
+
+    Camera using a perspective projection
+    

+ 7 - 0
doc/api/cameras/index.rst

@@ -0,0 +1,7 @@
+Cameras
+=======
+
+.. toctree::
+    Camera
+    OrthographicCamera
+    PerspectiveCamera

+ 101 - 2
doc/api/core/Color.rst

@@ -1,6 +1,105 @@
 Color - Represents a color
 --------------------------
 
-.. js:class:: Color()
+.. rubric:: Constructor
 
-    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)
+
+.. attribute:: Color.b
+
+    Blue channel (float between 0 and 1)
+
+.. rubric:: Methods
+
+.. 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)
+
+.. function:: Color.setHSV(h, s, v)
+
+    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
+
+::
+
+    var colors = [];
+    for ( i = 0; i < 5000; i ++ ) {
+        x = 2000 * Math.random() - 1000;
+        colors[ i ] = new THREE.Color( 0xffffff );
+        colors[ i ].setHSV( (x+1000)/2000, 1.0, 1.0 );
+    }

+ 7 - 0
doc/api/lights/AmbientLight.rst

@@ -0,0 +1,7 @@
+AmbientLight - An ambient light
+-------------------------------
+
+.. class:: AmbientLight()
+
+    An ambient light
+    

+ 7 - 0
doc/api/lights/DirectionalLight.rst

@@ -0,0 +1,7 @@
+DirectionalLight - A directional light
+--------------------------------------
+
+.. class:: DirectionalLight()
+
+    A directional light
+    

+ 7 - 0
doc/api/lights/Light.rst

@@ -0,0 +1,7 @@
+Light - Base class for light types
+----------------------------------
+
+.. class:: Light()
+
+    Base class for light types
+    

+ 7 - 0
doc/api/lights/PointLight.rst

@@ -0,0 +1,7 @@
+PointLight - A point light
+--------------------------
+
+.. class:: PointLight()
+
+    A point light
+    

+ 7 - 0
doc/api/lights/SpotLight.rst

@@ -0,0 +1,7 @@
+SpotLight - A spotlight
+-----------------------
+
+.. class:: SpotLight()
+
+    A spotlight
+    

+ 9 - 0
doc/api/lights/index.rst

@@ -0,0 +1,9 @@
+Lights
+======
+
+.. toctree::
+    AmbientLight
+    DirectionalLight
+    Light
+    PointLight
+    SpotLight

+ 5 - 1
doc/conf.py

@@ -83,6 +83,8 @@ exclude_patterns = ['_build']
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
 
+highlight_language = 'javascript'
+
 # A list of ignored prefixes for module index sorting.
 #modindex_common_prefix = []
 
@@ -91,7 +93,7 @@ pygments_style = 'sphinx'
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'pyramid'
+html_theme = 'nature'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
@@ -240,3 +242,5 @@ texinfo_documents = [
 
 # How to display URL addresses: 'footnote', 'no', or 'inline'.
 #texinfo_show_urls = 'footnote'
+
+primary_domain = "js"