Procházet zdrojové kódy

Merge remote-tracking branch 'gero3/documentation' into dev

Mr.doob před 12 roky
rodič
revize
b212de7f72

+ 1 - 1
docs/api/cameras/Camera.html

@@ -41,7 +41,7 @@
 		<div>
 		vector — point to look at<br />
 		<br />
-		This make the camera look at the vector position in local space.
+		This makes the camera look at the vector position in the global space as long as the parent of this camera is the scene or at position (0,0,0).
 		</div>
 
 

+ 44 - 7
docs/api/core/EventDispatcher.html

@@ -9,24 +9,61 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">JavaScript events for custom objects</div>
+		
+		<h2>Example</h2>
 
+		<code>
+var Car = function () {
+
+	EventDispatcher.call( this );
+	this.start = function () { 
+		this.dispatchEvent( { type: 'start', message: 'vroom vroom!' } ); 
+	};
+	
+};
+	
+var car = new Car();
+car.addEventListener( 'start', function ( event ) { 
+    alert( event.message ); 
+} );
+car.start();
+	    </code>
 
 		<h2>Constructor</h2>
 
 		<h3>[name]()</h3>
+		<div>
+		Creates eventDispatcher object. It needs to be call with '.call' to add the functionality to an object.
+		</div>
 
 
-		<h2>Properties</h2>
-
-		<h3>.[page:Vector3 todo]</h3>
+		<h2>Methods</h2>
 
+		<h3>.addEventListener( [page:String type], [page:Function listener] )</h3>
+		<div>
+		type - The type of event to listen to.<br />
+		listener - The function that gets called when the event is fired.
+		</div>
+		<div>
+		Adds a listener to an event type.
+		</div>
 
-		<h2>Methods</h2>
+		<h3>.removeEventListener( [page:String type], [page:Function listener] )</h3>
+		<div>
+		type - The type of the listener that gets removed.<br />
+		listener - The listener function that gets removed.
+		</div>
+		<div>
+		Removes a listener from an event type.
+		</div>
 
-		<h3>.todo( [page:Vector3 todo] )</h3>
+		<h3>.dispatchEvent( [page:String type] )</h3>
+		<div>
+		type - The type of event that gets fired.
+		</div>
 		<div>
-		todo — todo<br />
+		Fire an event type.
 		</div>
 
 

+ 7 - 0
docs/api/core/Face3.html

@@ -86,7 +86,14 @@
 		Face centroid.
 		</div>
 
+		<h2>Methods</h2>
 
+		<h3>.clone()</h3>
+		<div>
+		Creates a new clone of the Face3 object.
+		</div>
+		
+		
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 7 - 0
docs/api/core/Face4.html

@@ -92,7 +92,14 @@
 		Face centroid.
 		</div>
 
+		<h2>Methods</h2>
 
+		<h3>.clone()</h3>
+		<div>
+		Creates a new clone of the Face4 object.
+		</div>
+		
+		
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 85 - 11
docs/api/core/Geometry.html

@@ -9,7 +9,10 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">Base class for geometries</div>
+		<div class="desc">
+		Base class for geometries.<br />
+		A geometry holds all data nessecary to describe a 3D model.
+		</div>
 
 
 		<h2>Example</h2>
@@ -44,42 +47,51 @@
 
 		<h3>.[page:Array vertices]</h3>
 		<div>
-		Array of [page:Vector3 vertices].
+		Array of [page:Vector3 vertices].<br />
+		The array of vertices hold every position of points of the model.<br />
+		To signal an update in this array, [page:Geometry Geometry.verticesNeedUpdate] needs to be set to true.
 		</div>
 
 		<h3>.[page:Array colors]</h3>
 		<div>
 		Array of vertex [page:Color colors], matching number and order of vertices.<br />
 		Used in [page:ParticleSystem], [page:Line] and [page:Ribbon].<br />
-		[page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.
+		[page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.<br />
+		To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true.
 		</div>
 
-		<h3>.[page:Array materials]</h3>
+		<h3>.[page:Array normals]</h3>
 		<div>
-		Array of [page:Material materials].
+		Array of vertex [page:Vector3 normals], matching number and order of vertices.<br />
+		[link:http://en.wikipedia.org/wiki/Normal_(geometry) Normal vectors] are  nessecary for lighting <br />
+		To signal an update in this array, [page:Geometry Geometry.normalsNeedUpdate] needs to be set to true.
 		</div>
 
 		<h3>.[page:Array faces]</h3>
 		<div>
-		Array of [page:Face3 triangles] or/and [page:Face4 quads].
+		Array of [page:Face3 triangles] or/and [page:Face4 quads].<br />
+		The array of faces describe how each vertex in the model is connected with each other.<br />
+		To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true.
 		</div>
 
 		<h3>.[page:Array faceUvs]</h3>
 		<div>
 		Array of face [page:UV] layers.<br />
-		Each UV layer is an array of [page:UV] matching order and number of faces.
+		Each UV layer is an array of [page:UV] matching order and number of faces.<br />
+		To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
 		</div>
 
 		<h3>.[page:Array faceVertexUvs]</h3>
 		<div>
 		Array of face [page:UV] layers.<br />
-		Each UV layer is an array of [page:UV] matching order and number of vertices in faces.
+		Each UV layer is an array of [page:UV] matching order and number of vertices in faces.<br />
+		To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
 		</div>
 
 		<h3>.[page:Array morphTargets]</h3>
 		<div>
 		Array of morph targets. Each morph target is a Javascript object:
-		<code>{ name: "targetName", vertices: [ new THREE.Vertex(), ... ] }</code>
+		<code>{ name: "targetName", vertices: [ new THREE.Vector3(), ... ] }</code>
 		Morph vertices match number and order of primary vertices.
 		</div>
 
@@ -90,6 +102,12 @@
 		Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors).
 		</div>
 
+		<h3>.[page:Array morphColors]</h3>
+		<div>
+		Array of morph normals. Morph Normals have similar structure as morph targets, each normal set is a Javascript object:
+		<code>morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }</code>
+		</div>
+
 		<h3>.[page:Array skinWeights]</h3>
 		<div>
 		Array of skinning weights, matching number and order of vertices.
@@ -120,9 +138,49 @@
 		<h3>.[page:Boolean dynamic]</h3>
 		<div>
 		Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).<br/>
-		Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.
+		Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.<br/>
+		Defaults to true.
+		</div>
+		
+		<h3>.verticesNeedUpdate</h3>
+		<div>
+		Set to *true* if the vertices array has been updated.
+		</div>
+		
+		<h3>.elementsNeedUpdate</h3>
+		<div>
+		Set to *true* if the faces array has been updated.
+		</div>
+		
+		<h3>.uvsNeedUpdate</h3>
+		<div>
+		Set to *true* if the uvs array has been updated.
+		</div>
+		
+		<h3>.normalsNeedUpdate</h3>
+		<div>
+		Set to *true* if the normals array has been updated.
+		</div>
+		
+		<h3>.tangentsNeedUpdate</h3>
+		<div>
+		Set to *true* if the tangents in the faces has been updated.
+		</div>
+		
+		<h3>.colorsNeedUpdate</h3>
+		<div>
+		Set to *true* if the colors array has been updated.
+		</div>
+		
+		<h3>.lineDistancesNeedUpdate</h3>
+		<div>
+		Set to *true* if the linedistances array has been updated.
+		</div>
+		
+		<h3>.buffersNeedUpdate</h3>
+		<div>
+		Set to *true* if an array has changed in length.
 		</div>
-
 
 		<h2>Methods</h2>
 
@@ -147,6 +205,11 @@
 		Face normals must be existing / computed beforehand.
 		</div>
 
+		<h3>.computeMorphNormals()</h3>
+		<div>
+		Computes morph normals.
+		</div>
+
 		<h3>.computeTangents()</h3>
 		<div>
 		Computes vertex tangents.<br />
@@ -171,6 +234,17 @@
 		Checks for duplicate vertices using hashmap.<br />
 		Duplicated vertices are removed and faces' vertices are updated.
 		</div>
+		
+		<h3>.clone()</h3>
+		<div>
+		Creates a new clone of the Geometry.
+		</div>
+		
+		<h3>.dispose()</h3>
+		<div>
+		Removes The object from memory. <br />
+		Don't forget to call this method when you remove an geometry because it can cuase meomory leaks. 
+		</div>
 
 
 		<h2>Source</h2>

+ 69 - 11
docs/api/core/Object3D.html

@@ -76,7 +76,7 @@
 
 		<h3>.[page:Quaternion quaternion]</h3>
 		<div>
-		Global rotation.
+		Object's local rotation as [page:Quaternion Quaternion]. Only used when useQuaternion is set to true.
 		</div>
 
 		<h3>.[page:Boolean useQuaternion]</h3>
@@ -84,14 +84,6 @@
 		Use quaternion instead of Euler angles for specifying local rotation.
 		</div>
 
-		<h3>.[page:Float boundRadius]</h3>
-		<div>Default is 0.0.</div>
-
-		<h3>.[page:Float boundRadiusScale]</h3>
-		<div>
-		Maximum scale from x, y, z scale components.
-		</div>
-
 		<h3>.[page:Float renderDepth]</h3>
 		<div>
 		Override depth-sorting order if non *null*.
@@ -113,16 +105,35 @@
 		</div>
 
 		<h3>.[page:Boolean frustumCulled]</h3>
+		<div>
+		When this is set, it checks every frame if the object is in the frustum of the camera. Otherwise the object gets drawn every frame even if it isn't visible.
+		</div>
 
 		<h3>.[page:Boolean matrixAutoUpdate]</h3>
+		<div>
+		When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.
+		</div>
 
 		<h3>.[page:Boolean matrixWorldNeedsUpdate]</h3>
+		<div>
+		When this is set, it calculates the matrixWorld in that frame and resets this property to false.
+		</div>
 
 		<h3>.[page:Boolean rotationAutoUpdate]</h3>
-
+		<div>
+		When this is set, then the rotationMatrix gets calculated every frame.
+		</div>
 
 		<h2>Methods</h2>
-
+		
+		<h3>.applyMatrix( [page:Matrix4 matrix])</h3>
+		<div>
+		matrix - matrix
+		</div>
+		<div>
+		This updates the position, rotation and scale with the matrix.
+		</div>
+		
 		<h3>.translate( [page:Float distance], [page:Vector3 axis] )</h3>
 		<div>
 		distance - Distance.<br />
@@ -134,34 +145,76 @@
 
 		<h3>.translateX( [page:Float distance] )</h3>
 		<div>
+		distance - Distance.<br />
+		</div>
+		<div>
 		Translates object along x axis by distance.
 		</div>
 
 		<h3>.translateY( [page:Float distance] )</h3>
 		<div>
+		distance - Distance.<br />
+		</div>
+		<div>
 		Translates object along y axis by distance.
 		</div>
 
 		<h3>.translateZ( [page:Float distance] )</h3>
 		<div>
+		distance - Distance.<br />
+		</div>
+		<div>
 		Translates object along z axis by distance.
 		</div>
+		
+		<h3>.localToWorld( [page:Vector3 vector] )</h3>
+		<div>
+		vector - A local vector.<br />
+		</div>
+		<div>
+		Updates the vector from local space to world space.
+		</div>
+
+		<h3>.worldToLocal( [page:Vector3 vector] )</h3>
+		<div>
+		vector - A world vector.<br />
+		</div>
+		<div>
+		Updates the vector from world space to local space.
+		</div>
 
 		<h3>.lookAt( [page:Vector3 vector] )</h3>
 		<div>
+		vector - A world vector to look at.<br />
+		</div>
+		<div>
 		Rotates object to face point in space.
 		</div>
 
 		<h3>.add( [page:Object3D object] )</h3>
 		<div>
+		object - An object.<br />
+		</div>
+		<div>
 		Adds *object* as child of this object.
 		</div>
 
 		<h3>.remove( [page:Object3D object] )</h3>
 		<div>
+		object - An object.<br />
+		</div>
+		<div>
 		Removes *object* as child of this object.
 		</div>
 
+		<h3>.traverse( [page:Function callback] )</h3>
+		<div>
+		callback - An Function with as first argument an object3D object.<br />
+		</div>
+		<div>
+		Executes the callback on this object and all descendants. 
+		</div>
+
 		<h3>.getChildByName( [page:String name], [page:Boolean recursive] )</h3>
 		<div>
 		name - Object name.<br />
@@ -189,6 +242,11 @@
 		Updates global transform of the object and its children.
 		</div>
 
+		<h3>.clone()</h3>
+		<div>
+		Creates a new clone of this object and all descendants.
+		</div>
+
 
 		<h2>Source</h2>
 

+ 1 - 1
docs/page.css

@@ -61,7 +61,7 @@ code {
 	width: -moz-calc( 100% - 40px );
 	width: calc( 100% - 40px );
 	padding: 20px;
-	white-space: pre-line;
+	white-space: pre-wrap;
 	background-color: #f9f9f9;
 	overflow: auto;
 }

+ 1 - 1
docs/page.js

@@ -24,7 +24,7 @@ var onDocumentLoad = function ( event ) {
 	text = text.replace(/\[page:(\w+)\]/gi, "[page:$1 $1]" ); // [page:name] to [page:name title]
 	text = text.replace(/\[page:(\w+) ([\w|\.]+)\]/gi, "<a href=\"javascript:window.parent.goTo('$1')\" title=\"$1\">$2</a>" ); // [page:name title]
 	text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_]+)\]/gi, "[link:$1 $1]" ); // [link:url] to [link:url title]
-	text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_]+) ([\w|\:|\/|\.|\-|\_]+)\]/gi, "<a href=\"$1\"  target=\"_blank\">$2</a>" ); // [link:url title]
+	text = text.replace(/\[link:([\w|\:|\/|\.|\-|\_|\(|\)]+) ([\w|\:|\/|\.|\-|\_ ]+)\]/gi, "<a href=\"$1\"  target=\"_blank\">$2</a>" ); // [link:url title]
 	text = text.replace(/\*([\w|\d|\"|\-|\(][\w|\d|\ |\-|\/|\+|\-|\(|\)|\=|\,|\.\"]*[\w|\d|\"|\)]|\w)\*/gi, "<strong>$1</strong>" ); // *
 
 	document.body.innerHTML = text;