Przeglądaj źródła

Merge remote-tracking branch 'zz85/docs' into dev

Mr.doob 12 lat temu
rodzic
commit
ef79b0e686

+ 11 - 14
docs/api/extras/core/Curve.html

@@ -9,7 +9,7 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">An extensible curve object which contains methods for interpolation</div>
 
 
 		<h2>Constructor</h2>
@@ -25,37 +25,34 @@
 		<h2>Methods</h2>
 
 		<h3>.getPoint ( t )</h3>
-		<div>todo</div>
+		<div>Returns a vector for point t of the curve where t is between 0 and 1</div>
 
 		<h3>.getPointAt ( u )</h3>
-		<div>todo</div>
+		<div>Returns a vector for point at relative position in curve according to arc length</div>
 
 		<h3>.getPoints ( divisions )</h3>
-		<div>todo</div>
+		<div>Get sequence of points using getPoint( t ) </div>
 
 		<h3>.getSpacedPoints ( divisions )</h3>
-		<div>todo</div>
+		<div>Get sequence of equi-spaced points using getPointAt( u )</div>
 
 		<h3>.getLength ()</h3>
-		<div>todo</div>
+		<div>Get total curve arc length</div>
 
 		<h3>.getLengths ( divisions )</h3>
-		<div>todo</div>
+		<div>Get list of cumulative segment lengths</div>
 
 		<h3>.updateArcLengths ()</h3>
-		<div>todo</div>
+		<div>Update the cumlative segment distance cache</div>
 
 		<h3>.getUtoTmapping ( u, distance )</h3>
-		<div>todo</div>
-
-		<h3>.getNormalVector ( t )</h3>
-		<div>todo</div>
+		<div>Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equi distance</div>
 
 		<h3>.getTangent ( t )</h3>
-		<div>todo</div>
+		<div>Returns a unit vector tangent at t. If the subclassed curve do not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation</div>
 
 		<h3>.getTangentAt ( u )</h3>
-		<div>todo</div>
+		<div>Returns tangent at equidistance point u on the curve</div>
 
 
 		<h2>Source</h2>

+ 2 - 2
docs/api/extras/geometries/ExtrudeGeometry.html

@@ -9,12 +9,12 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">Creates extruded geometry from a path shape</div>
 
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( shapes, options )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/IcosahedronGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( radius, detail )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/LatheGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( points, steps, angle )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/OctahedronGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( radius, detail )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/PlaneGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( width, height, widthSegments, heightSegments )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/PolyhedronGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( vertices, faces, radius, detail )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/TetrahedronGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( radius, detail )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/TextGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( text, parameters )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/TorusGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( radius, tube, radialSegments, tubularSegments, arc )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/extras/geometries/TorusKnotGeometry.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( radius, tube, radialSegments, tubularSegments, arc )</h3>
 
 
 		<h2>Properties</h2>

+ 5 - 4
docs/api/extras/modifiers/SubdivisionModifier.html

@@ -9,17 +9,18 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">Applies Catmull-Clark Subdivision Surfaces for creating smooth geometry meshes</div>
 
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( subdivisions )</h3>
 
 
 		<h2>Properties</h2>
 
 		<h3>.subdivisions</h3>
+		<div>Number of time subdivision will be applied</div>
 
 		<h3>.useOldVertexColors</h3>
 
@@ -30,10 +31,10 @@
 		<h2>Methods</h2>
 
 		<h3>.modify ( geometry )</h3>
-		<div>todo</div>
+		<div>Modifies the geometry by running subdivision surfaces. This calls .smooth() internally</div>
 
 		<h3>.smooth ( oldGeometry )</h3>
-		<div>todo</div>
+		<div>Performs an iteration of Catmull-Clark Subdivision</div>
 
 
 

+ 1 - 1
docs/api/extras/objects/LensFlare.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( texture, size, distance, blending, color )</h3>
 
 
 		<h2>Properties</h2>

+ 4 - 2
docs/api/materials/ShaderMaterial.html

@@ -11,12 +11,14 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">Material rendered with custom shaders</div>
 
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( parameters )
+
+</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/textures/DataTexture.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy )</h3>
 
 
 		<h2>Properties</h2>

+ 1 - 1
docs/api/textures/Texture.html

@@ -14,7 +14,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]()</h3>
+		<h3>[name]( image, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy )</h3>
 
 
 		<h2>Properties</h2>

+ 36 - 4
docs/index.html

@@ -104,6 +104,9 @@
 
 			var html = '<h1><a href="http://threejs.org">three.js</a><span style="font-size: 50%; vertical-align: super;"> r' + REVISION + '</span></h1>';
 
+			var DELIMITER = '/';
+			var nameCategoryMap = {};
+
 			for ( var section in list ) {
 
 				html += '<h2>' + section + '</h2>';
@@ -122,6 +125,12 @@
 
 						html += '<li><a href="javascript:goTo(\'' + section + '\', \'' + category + '\', \'' + page[ 0 ] + '\')">' + page[ 0 ] + '</a></li>';
 
+						nameCategoryMap[page[0]] = {
+							section: section,
+							category: category,
+							name: page[0]
+						};
+
 					}
 
 					html += '</ul>';
@@ -134,13 +143,36 @@
 
 			panel.innerHTML += html;
 
+			function encodeUrl( path ) {
+
+				return path.replace(/\ \/\ /g, '.').replace(/\ /g, '_');
+
+			}
+
+			function decodeUrl( path ) {
+
+				return path.replace(/_/g, ' ').replace(/\./g, ' / ');
+
+			}
+
 			// Page loading
 
 			function goTo( section, category, name ) {
 
-				window.document.title = 'three.js - documentation - ' + section + ' - ' + name;
+				// Fully resolve links that only provide a name
+				if(arguments.length == 1) {
+					var location = nameCategoryMap[section];
+					section = location.section;
+					category = location.category;
+					name = location.name;
+				}
+
+				var title = 'three.js - documentation - ' + section + ' - ' + name;
+				var url = encodeUrl(section) + DELIMITER + encodeUrl( category ) + DELIMITER + encodeUrl(name);
+
+				window.location.hash = url;
+				window.document.title = title;
 
-				window.location.hash = section + '/' + category + '/' + name.replace(/\ /g, '-');
 
 				viewer.src = pages[ section ][ category ][ name ] + '.html';
 
@@ -148,8 +180,8 @@
 
 			function goToHash() {
 
-				var hash = window.location.hash.substring( 1 ).split('/');
-				goTo( hash[0], hash[1], hash[2].replace(/\-/g, ' ') );
+				var hash = window.location.hash.substring( 1 ).split(DELIMITER);
+				goTo( decodeUrl(hash[0]), decodeUrl(hash[1]), decodeUrl(hash[2]) );
 
 			}
 

+ 10 - 22
src/extras/core/Curve.js

@@ -1,7 +1,7 @@
 /**
  * @author zz85 / http://www.lab4games.net/zz85/blog
  * Extensible curve object
- * 
+ *
  * Some common of Curve methods
  * .getPoint(t), getTangent(t)
  * .getPointAt(u), getTagentAt(u)
@@ -110,8 +110,8 @@ THREE.Curve.prototype.getLengths = function ( divisions ) {
 
 	if ( !divisions ) divisions = (this.__arcLengthDivisions) ? (this.__arcLengthDivisions): 200;
 
-	if ( this.cacheArcLengths 
-		&& ( this.cacheArcLengths.length == divisions + 1 ) 
+	if ( this.cacheArcLengths
+		&& ( this.cacheArcLengths.length == divisions + 1 )
 		&& !this.needsUpdate) {
 
 		//console.log( "cached", this.cacheArcLengths );
@@ -231,22 +231,10 @@ THREE.Curve.prototype.getUtoTmapping = function ( u, distance ) {
 
 };
 
-
-// In 2D space, there are actually 2 normal vectors,
-// and in 3D space, infinte
-// TODO this should be depreciated.
-THREE.Curve.prototype.getNormalVector = function( t ) {
-
-	var vec = this.getTangent( t );
-
-	return new THREE.Vector2( -vec.y , vec.x );
-
-};
-
 // Returns a unit vector tangent at t
-// In case any sub curve does not implement its tangent / normal finding,
-// we get 2 points with a small delta and find a gradient of the 2 points
-// which seems to make a reasonable approximation
+// In case any sub curve does not implement its tangent derivation,
+// 2 points a small delta apart will be used to find its gradient
+// which seems to give a reasonable approximation
 
 THREE.Curve.prototype.getTangent = function( t ) {
 
@@ -261,7 +249,7 @@ THREE.Curve.prototype.getTangent = function( t ) {
 
 	var pt1 = this.getPoint( t1 );
 	var pt2 = this.getPoint( t2 );
-	
+
 	var vec = pt2.clone().subSelf(pt1);
 	return vec.normalize();
 
@@ -715,7 +703,7 @@ THREE.SplineCurve3 = THREE.Curve.create(
 // 	v.z = THREE.Curve.Utils.tangentSpline( t, pt0.z, pt1.z, pt2.z, pt3.z );
 
 // 	return v;
-		
+
 // }
 
 /**************************************************************
@@ -741,7 +729,7 @@ THREE.ClosedSplineCurve3 = THREE.Curve.create(
 
         intPoint = Math.floor( point );
         weight = point - intPoint;
-            
+
         intPoint += intPoint > 0 ? 0 : ( Math.floor( Math.abs( intPoint ) / points.length ) + 1 ) * points.length;
         c[ 0 ] = ( intPoint - 1 ) % points.length;
         c[ 1 ] = ( intPoint ) % points.length;
@@ -751,7 +739,7 @@ THREE.ClosedSplineCurve3 = THREE.Curve.create(
         v.x = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].x, points[ c[ 1 ] ].x, points[ c[ 2 ] ].x, points[ c[ 3 ] ].x, weight );
         v.y = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].y, points[ c[ 1 ] ].y, points[ c[ 2 ] ].y, points[ c[ 3 ] ].y, weight );
         v.z = THREE.Curve.Utils.interpolate( points[ c[ 0 ] ].z, points[ c[ 1 ] ].z, points[ c[ 2 ] ].z, points[ c[ 3 ] ].z, weight );
-        
+
         return v;
 
     }