提交 b212de7f 编写于 作者: M Mr.doob

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

...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<div> <div>
vector — point to look at<br /> vector — point to look at<br />
<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> </div>
......
...@@ -9,24 +9,61 @@ ...@@ -9,24 +9,61 @@
<body> <body>
<h1>[name]</h1> <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> <h2>Constructor</h2>
<h3>[name]()</h3> <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> <h2>Methods</h2>
<h3>.[page:Vector3 todo]</h3>
<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> <div>
todo — todo<br /> Fire an event type.
</div> </div>
......
...@@ -86,7 +86,14 @@ ...@@ -86,7 +86,14 @@
Face centroid. Face centroid.
</div> </div>
<h2>Methods</h2>
<h3>.clone()</h3>
<div>
Creates a new clone of the Face3 object.
</div>
<h2>Source</h2> <h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
...@@ -92,7 +92,14 @@ ...@@ -92,7 +92,14 @@
Face centroid. Face centroid.
</div> </div>
<h2>Methods</h2>
<h3>.clone()</h3>
<div>
Creates a new clone of the Face4 object.
</div>
<h2>Source</h2> <h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js] [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
<body> <body>
<h1>[name]</h1> <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> <h2>Example</h2>
...@@ -44,42 +47,51 @@ ...@@ -44,42 +47,51 @@
<h3>.[page:Array vertices]</h3> <h3>.[page:Array vertices]</h3>
<div> <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> </div>
<h3>.[page:Array colors]</h3> <h3>.[page:Array colors]</h3>
<div> <div>
Array of vertex [page:Color colors], matching number and order of vertices.<br /> Array of vertex [page:Color colors], matching number and order of vertices.<br />
Used in [page:ParticleSystem], [page:Line] and [page:Ribbon].<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> </div>
<h3>.[page:Array materials]</h3> <h3>.[page:Array normals]</h3>
<div> <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> </div>
<h3>.[page:Array faces]</h3> <h3>.[page:Array faces]</h3>
<div> <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> </div>
<h3>.[page:Array faceUvs]</h3> <h3>.[page:Array faceUvs]</h3>
<div> <div>
Array of face [page:UV] layers.<br /> 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> </div>
<h3>.[page:Array faceVertexUvs]</h3> <h3>.[page:Array faceVertexUvs]</h3>
<div> <div>
Array of face [page:UV] layers.<br /> 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> </div>
<h3>.[page:Array morphTargets]</h3> <h3>.[page:Array morphTargets]</h3>
<div> <div>
Array of morph targets. Each morph target is a Javascript object: 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. Morph vertices match number and order of primary vertices.
</div> </div>
...@@ -90,6 +102,12 @@ ...@@ -90,6 +102,12 @@
Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors). Morph colors can match either number and order of faces (face colors) or number of vertices (vertex colors).
</div> </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> <h3>.[page:Array skinWeights]</h3>
<div> <div>
Array of skinning weights, matching number and order of vertices. Array of skinning weights, matching number and order of vertices.
...@@ -120,9 +138,49 @@ ...@@ -120,9 +138,49 @@
<h3>.[page:Boolean dynamic]</h3> <h3>.[page:Boolean dynamic]</h3>
<div> <div>
Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).<br/> 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> </div>
<h2>Methods</h2> <h2>Methods</h2>
...@@ -147,6 +205,11 @@ ...@@ -147,6 +205,11 @@
Face normals must be existing / computed beforehand. Face normals must be existing / computed beforehand.
</div> </div>
<h3>.computeMorphNormals()</h3>
<div>
Computes morph normals.
</div>
<h3>.computeTangents()</h3> <h3>.computeTangents()</h3>
<div> <div>
Computes vertex tangents.<br /> Computes vertex tangents.<br />
...@@ -171,6 +234,17 @@ ...@@ -171,6 +234,17 @@
Checks for duplicate vertices using hashmap.<br /> Checks for duplicate vertices using hashmap.<br />
Duplicated vertices are removed and faces' vertices are updated. Duplicated vertices are removed and faces' vertices are updated.
</div> </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> <h2>Source</h2>
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
<h3>.[page:Quaternion quaternion]</h3> <h3>.[page:Quaternion quaternion]</h3>
<div> <div>
Global rotation. Object's local rotation as [page:Quaternion Quaternion]. Only used when useQuaternion is set to true.
</div> </div>
<h3>.[page:Boolean useQuaternion]</h3> <h3>.[page:Boolean useQuaternion]</h3>
...@@ -84,14 +84,6 @@ ...@@ -84,14 +84,6 @@
Use quaternion instead of Euler angles for specifying local rotation. Use quaternion instead of Euler angles for specifying local rotation.
</div> </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> <h3>.[page:Float renderDepth]</h3>
<div> <div>
Override depth-sorting order if non *null*. Override depth-sorting order if non *null*.
...@@ -113,16 +105,35 @@ ...@@ -113,16 +105,35 @@
</div> </div>
<h3>.[page:Boolean frustumCulled]</h3> <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> <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> <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> <h3>.[page:Boolean rotationAutoUpdate]</h3>
<div>
When this is set, then the rotationMatrix gets calculated every frame.
</div>
<h2>Methods</h2> <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> <h3>.translate( [page:Float distance], [page:Vector3 axis] )</h3>
<div> <div>
distance - Distance.<br /> distance - Distance.<br />
...@@ -134,34 +145,76 @@ ...@@ -134,34 +145,76 @@
<h3>.translateX( [page:Float distance] )</h3> <h3>.translateX( [page:Float distance] )</h3>
<div> <div>
distance - Distance.<br />
</div>
<div>
Translates object along x axis by distance. Translates object along x axis by distance.
</div> </div>
<h3>.translateY( [page:Float distance] )</h3> <h3>.translateY( [page:Float distance] )</h3>
<div> <div>
distance - Distance.<br />
</div>
<div>
Translates object along y axis by distance. Translates object along y axis by distance.
</div> </div>
<h3>.translateZ( [page:Float distance] )</h3> <h3>.translateZ( [page:Float distance] )</h3>
<div> <div>
distance - Distance.<br />
</div>
<div>
Translates object along z axis by distance. Translates object along z axis by distance.
</div> </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> <h3>.lookAt( [page:Vector3 vector] )</h3>
<div> <div>
vector - A world vector to look at.<br />
</div>
<div>
Rotates object to face point in space. Rotates object to face point in space.
</div> </div>
<h3>.add( [page:Object3D object] )</h3> <h3>.add( [page:Object3D object] )</h3>
<div> <div>
object - An object.<br />
</div>
<div>
Adds *object* as child of this object. Adds *object* as child of this object.
</div> </div>
<h3>.remove( [page:Object3D object] )</h3> <h3>.remove( [page:Object3D object] )</h3>
<div> <div>
object - An object.<br />
</div>
<div>
Removes *object* as child of this object. Removes *object* as child of this object.
</div> </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> <h3>.getChildByName( [page:String name], [page:Boolean recursive] )</h3>
<div> <div>
name - Object name.<br /> name - Object name.<br />
...@@ -189,6 +242,11 @@ ...@@ -189,6 +242,11 @@
Updates global transform of the object and its children. Updates global transform of the object and its children.
</div> </div>
<h3>.clone()</h3>
<div>
Creates a new clone of this object and all descendants.
</div>
<h2>Source</h2> <h2>Source</h2>
......
...@@ -61,7 +61,7 @@ code { ...@@ -61,7 +61,7 @@ code {
width: -moz-calc( 100% - 40px ); width: -moz-calc( 100% - 40px );
width: calc( 100% - 40px ); width: calc( 100% - 40px );
padding: 20px; padding: 20px;
white-space: pre-line; white-space: pre-wrap;
background-color: #f9f9f9; background-color: #f9f9f9;
overflow: auto; overflow: auto;
} }
......
...@@ -24,7 +24,7 @@ var onDocumentLoad = function ( event ) { ...@@ -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+)\]/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(/\[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|\:|\/|\.|\-|\_]+)\]/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>" ); // * text = text.replace(/\*([\w|\d|\"|\-|\(][\w|\d|\ |\-|\/|\+|\-|\(|\)|\=|\,|\.\"]*[\w|\d|\"|\)]|\w)\*/gi, "<strong>$1</strong>" ); // *
document.body.innerHTML = text; document.body.innerHTML = text;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册