Ver Fonte

Updated Skeleton and Skinned Mesh docs

Lewy Blue há 8 anos atrás
pai
commit
9c81fd5c8e

+ 5 - 1
docs/api/objects/Points.html

@@ -12,7 +12,11 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A class for displaying points. For example, if using the [page:WebGLRenderer], the points are displayed using GL_POINTS.</div>
+		<div class="desc">
+			A class for displaying points.
+			The points are rendered by the [page:WebGLRenderer] using
+			[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.POINTS].
+		</div>
 
 
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>

+ 71 - 73
docs/api/objects/Skeleton.html

@@ -8,125 +8,123 @@
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />
 	</head>
 	</head>
 	<body>
 	<body>
-		
+
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
 		<div class="desc">
 		<div class="desc">
-		Use an array of [page:Bone bones] to create a skeleton that can be used by a [page:SkinnedMesh].
-		WebGL only.
+		Use an array of [page:Bone bones] to create a skeleton that can be used by a
+		[page:SkinnedMesh].
 		</div>
 		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
+		<div>
+
+<code>
+// Create a simple "arm"
+
+var bones = [];
+
+var shoulder = new THREE.Bone();
+var elbow = new THREE.Bone();
+var hand = new THREE.Bone();
+
+shoulder.add( elbow );
+elbow.add( hand );
+
+bones.push( shoulder );
+bones.push( elbow );
+bones.push( hand );
 
 
-		<code>
-		// Create a simple "arm"
-		
-		var bones = [];
-		
-		var shoulder = new THREE.Bone();
-		var elbow = new THREE.Bone();
-		var hand = new THREE.Bone();
-		
-		shoulder.add( elbow );
-		elbow.add( hand );
-
-		bones.push( shoulder );
-		bones.push( elbow );
-		bones.push( hand );
-		
-		shoulder.position.y = -5;
-		elbow.position.y = 0;
-		hand.position.y = 5;
-		
-		var armSkeleton = new THREE.Skeleton( bones );
-		
-		// See THREE.SkinnedMesh for an example of usage with a mesh
-		</code>
+shoulder.position.y = -5;
+elbow.position.y = 0;
+hand.position.y = 5;
+
+var armSkeleton = new THREE.Skeleton( bones );
+</code>
+			See the [page:SkinnedMesh] page for an example of usage with standard [page:BufferGeometry].
+ 		</div>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 
 
 		<h3>[name]( [page:Array bones], [page:Array boneInverses], [page:Boolean useVertexTexture]  )</h3>
 		<h3>[name]( [page:Array bones], [page:Array boneInverses], [page:Boolean useVertexTexture]  )</h3>
 		<div>
 		<div>
-		bones — The array of [page:bone bones]<br/>
-		boneInverses — (optional) An array of [page:Matrix4 Matrix4s]<br/>
-		useVertexTexture — (optional) Whether or not to use a vertex texture in the shader.
-		</div>
-		<div>
-		The constructor automatically sets up all of the properties below.
+		[page:Array bones] - The array of [page:Bone bones]. Default is an empty array.<br/>
+		[page:Array boneInverses] - (optional) An array of [page:Matrix4 Matrix4s].<br/>
+		[page:Boolean useVertexTexture] - (optional) Whether or not to use a vertex texture in the shader.
+		Default is true.<br /><br />
+
+		Creates a new [name].
 		</div>
 		</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
-		
+
 		<h3>[property:Array bones]</h3>
 		<h3>[property:Array bones]</h3>
 		<div>
 		<div>
-		The array of [page:bone bones]
+		The array of [page:bone bones]. Note this is a copy of the original array, not a reference,
+		so you can modify the original array without effecting this one.
 		</div>
 		</div>
-		
-		
-		<h3>[property:Boolean useVertexTexture]</h3>
+
+		<h3>[property:Array boneInverses]</h3>
 		<div>
 		<div>
-		Whether or not to use a vertex texture in the shader, set in the constructor. Not all devices
-		support floating point pixel textures. If this option is set then the bone matrices will be packed into
-		a texture and sent to the shader. This method allows a much larger set of bones to be used. Otherwise
-		the vertex shader will use uniforms, which do not allow for as many bones to be used. The exact
-		numbers vary between devices.
+		An array of [page:Matrix4 Matrix4s] that represent the inverse of the [page:Matrix4 matrixWorld]
+		of the individual bones.
 		</div>
 		</div>
-		
-		
-		<h3>[property:Array boneInverses]</h3>
+
+		<h3>[property:Float32Array boneMatrices]</h3>
 		<div>
 		<div>
-		An array of [page:Matrix4 Matrix4s] that represent the inverse of the matrixWorld of the individual bones.
+		The array buffer holding the bone data when using a vertex texture.
 		</div>
 		</div>
-		
-		
-		<h3>[property:Integer boneTextureWidth]</h3>
+
+		<h3>[property:DataTexture boneTexture]</h3>
 		<div>
 		<div>
-		The width of the vertex data texture.
+		The [page:DataTexture] holding the bone data when using a vertex texture.
 		</div>
 		</div>
-		
-		
+
 		<h3>[property:Integer boneTextureHeight]</h3>
 		<h3>[property:Integer boneTextureHeight]</h3>
 		<div>
 		<div>
 		The height of the vertex data texture.
 		The height of the vertex data texture.
 		</div>
 		</div>
-		
-		
-		<h3>[property:Float32Array boneMatrices]</h3>
+
+		<h3>[property:Integer boneTextureWidth]</h3>
 		<div>
 		<div>
-		The array buffer holding the bone data when using a vertex texture.
+		The width of the vertex data texture.
 		</div>
 		</div>
-		
-		
-		<h3>[property:DataTexture boneTexture]</h3>
+
+		<h3>[property:Boolean useVertexTexture]</h3>
 		<div>
 		<div>
-		The [page:DataTexture] holding the bone data when using a vertex texture.
+		Whether or not to use a vertex texture in the shader, set in the constructor.
+		Not all devices	support floating point pixel textures. If this option is set then
+		the bone matrices will be packed into	a texture and sent to the shader. This method
+		allows a much larger set of bones to be used. Otherwise	the vertex shader will use
+		uniforms, which do not allow for as many bones to be used. The exact numbers vary
+		between devices.
 		</div>
 		</div>
-		
+
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
+		<h3>[method:Skeleton clone]()</h3>
+		<div>
+		Returns a clone of this Skeleton object.
+		</div>
+
+
 		<h3>[method:null calculateInverses]()</h3>
 		<h3>[method:null calculateInverses]()</h3>
-		<div>Generates the boneInverses.</div>
-		
-		
+		<div>Generates the [page:.boneInverses boneInverses] array if not provided in the constructor.</div>
+
+
 		<h3>[method:null pose]()</h3>
 		<h3>[method:null pose]()</h3>
 		<div>Returns the skeleton to the base pose.</div>
 		<div>Returns the skeleton to the base pose.</div>
-		
-		
+
+
 		<h3>[method:null update]()</h3>
 		<h3>[method:null update]()</h3>
 		<div>
 		<div>
 		Updates the [page:Float32Array boneMatrices] and [page:DataTexture boneTexture] after changing the bones.
 		Updates the [page:Float32Array boneMatrices] and [page:DataTexture boneTexture] after changing the bones.
 		This is called automatically by the [page:WebGLRenderer] if the skeleton is used with a [page:SkinnedMesh].
 		This is called automatically by the [page:WebGLRenderer] if the skeleton is used with a [page:SkinnedMesh].
 		</div>
 		</div>
-		
-		<h3>[method:Skeleton clone]()</h3>
-		<div>
-		Returns a clone of this Skeleton 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]

+ 45 - 39
docs/api/objects/SkinnedMesh.html

@@ -8,7 +8,7 @@
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />
 	</head>
 	</head>
 	<body>
 	<body>
-		[page:Object3D] &rarr;
+		[page:Object3D] &rarr; [page:Mesh] &rarr;
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
@@ -35,7 +35,7 @@
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
 		<code>
 		<code>
-		var geometry = new THREE.CylinderGeometry( 5, 5, 5, 5, 15, 5, 30 );
+		var geometry = new THREE.CylinderBufferGeometry( 5, 5, 5, 5, 15, 5, 30 );
 
 
 		//Create the skin indices and skin weights
 		//Create the skin indices and skin weights
 		for ( var i = 0; i < geometry.vertices.length; i ++ ) {
 		for ( var i = 0; i < geometry.vertices.length; i ++ ) {
@@ -66,64 +66,76 @@
 		</code>
 		</code>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
-
 		<h3>[name]( [page:Geometry geometry], [page:Material material], [page:boolean useVertexTexture] )</h3>
 		<h3>[name]( [page:Geometry geometry], [page:Material material], [page:boolean useVertexTexture] )</h3>
 		<div>
 		<div>
-        geometry — An instance of [page:Geometry]. [page:Geometry.skinIndices] and [page:Geometry.skinWeights] should be set.<br />
-        material — An instance of [page:Material] (optional).<br />
-		useVertexTexture -- Defines whether a vertex texture can be used (optional).
+    [page:Geometry geometry] - an instance of [page:Geometry] or [page:BufferGeometry] (recommended).
+		[page:Geometry.skinIndices skinIndices] and [page:Geometry.skinWeights skinWeights] should be set to true on the geometry.<br />
+    [page:Material material] - (optional) an instance of [page:Material]. Default is a new [page:MeshBasicMaterial] .<br />
+		[page:boolean useVertexTexture] - (optional) defines whether a vertex texture can be used. Default is true.
 		</div>
 		</div>
 
 
+
+
+
+
 		<h2>Properties</h2>
 		<h2>Properties</h2>
-		<div>See the base [page:Object3D] class for common properties.</div>
+		<div>See the base [page:Mesh] class for common properties.</div>
 
 
-		<h3>[property:array bones]</h3>
+		<h3>[property:string bindMode]</h3>
 		<div>
 		<div>
-		This contains the array of bones for this mesh. These should be set in the constructor.
+		Either "attached" or "detached". "attached" uses the [page:SkinnedMesh.matrixWorld]
+		property for the base transform	matrix of the bones. "detached" uses the
+		[page:SkinnedMesh.bindMatrix]. Default is "attached".
 		</div>
 		</div>
 
 
-		<h3>[property:Matrix4 identityMatrix]</h3>
+		<h3>[property:Matrix4 bindMatrix]</h3>
 		<div>
 		<div>
-		This is an identityMatrix to calculate the bones matrices from.
+		The base matrix that is used for the bound bone transforms.
 		</div>
 		</div>
 
 
-		<h3>[property:boolean useVertexTexture]</h3>
+		<h3>[property:Matrix4 bindMatrixInverse]</h3>
 		<div>
 		<div>
-		The boolean defines whether a vertex texture is used to calculate the bones. This boolean shouldn't be changed after constructor.
+		The base matrix that is used for resetting the bound bone transforms.
 		</div>
 		</div>
 
 
-		<h3>[property:array boneMatrices]</h3>
+		<h3>[property:array bones]</h3>
 		<div>
 		<div>
-		This array of matrices contains the matrices of the bones. These get calculated in the constructor.
+		This contains the array of [page:Bone bones] for this mesh. These should be set in
+		the constructor.
 		</div>
 		</div>
 
 
-		<h3>[property:string bindMode]</h3>
+		<h3>[property:Boolean isSkinnedMesh]</h3>
 		<div>
 		<div>
-		Either "attached" or "detached". "attached" uses the [page:SkinnedMesh.matrixWorld] property for the base transform
-		matrix of the bones. "detached" uses the [page:SkinnedMesh.bindMatrix].
-		</div>
+			Used to check whether this or derived classes are skinned meshes. Default is *true*.<br /><br />
 
 
-		<h3>[property:Matrix4 bindMatrix]</h3>
-		<div>
-		The base matrix that is used for the bound bone transforms.
+			You should not change this, as it used internally for optimisation.
 		</div>
 		</div>
 
 
-		<h3>[property:Matrix4 inverseBindMatrix]</h3>
+		<h3>[property:Skeleton skeleton]</h3>
 		<div>
 		<div>
-		The inverse of the bindMatrix.
+		[page:Skeleton] created from the [page:Geometry.bones bones] of the [page:Geometry] passed in the
+		constructor.
 		</div>
 		</div>
 
 
+
+
 		<h2>Methods</h2>
 		<h2>Methods</h2>
-		<div>See the base [page:Object3D] class for common methods.</div>
+		<div>See the base [page:Mesh] class for common methods.</div>
 
 
 		<h3>[method:null bind]( [page:Skeleton skeleton], [page:Matrix4 bindMatrix] )</h3>
 		<h3>[method:null bind]( [page:Skeleton skeleton], [page:Matrix4 bindMatrix] )</h3>
 		<div>
 		<div>
-		skeleton — [page:Skeleton]<br/>
-		bindMatrix — [page:Matrix4] that represents the base transform of the skeleton
+		[page:Skeleton skeleton] - [page:Skeleton] created from a [page:Bone Bones] tree.<br/>
+		[page:Matrix4 bindMatrix] - [page:Matrix4] that represents the base transform of the skeleton.<br /><br />
+
+		Bind a skeleton to the skinned mesh. The bindMatrix gets saved to .bindMatrix property
+		and the .bindMatrixInverse gets calculated. This is called automatically in the constructor, and the skeleton
+		is created from the [page:Geometry.bones bones] of the [page:Geometry] passed in the
+		constructor.
 		</div>
 		</div>
+
+		<h3>[method:SkinnedMesh clone]()</h3>
 		<div>
 		<div>
-		Bind a skeleton to the skinned mesh. The bindMatrix gets saved to .bindMatrix property and the .bindMatrixInverse
-		gets calculated.
+		Returns a clone of this SkinnedMesh object and any descendants.
 		</div>
 		</div>
 
 
 		<h3>[method:null normalizeSkinWeights]()</h3>
 		<h3>[method:null normalizeSkinWeights]()</h3>
@@ -133,21 +145,15 @@
 
 
 		<h3>[method:null pose]()</h3>
 		<h3>[method:null pose]()</h3>
 		<div>
 		<div>
-		This method sets the skinned mesh in the rest pose.
+		This method sets the skinned mesh in the rest pose (resets the pose).
 		</div>
 		</div>
 
 
-		<h3>[method:Bone addBone]( [page:Bone bone] )</h3>
+		<h3>[method:null updateMatrixWorld]( [page:Boolean force] )</h3>
 		<div>
 		<div>
-		bone — This is the bone that needs to be added. (optional)
-		</div>
-		<div>
-		This method adds the bone to the skinned mesh when it is provided. It creates a new bone and adds that when no bone is given.
+		Updates the [page:Matrix4 MatrixWorld].
 		</div>
 		</div>
 
 
-		<h3>[method:SkinnedMesh clone]()</h3>
-		<div>
-		Returns a clone of this SkinnedMesh object and its descendants.
-		</div>
+
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>