Browse Source

Merge pull request #6530 from TatumCreative/docs-updates-misc2

Docs: existing todos are complete
Ricardo Cabello 10 years ago
parent
commit
7b2c3e076b

+ 32 - 17
docs/api/objects/LOD.html

@@ -11,16 +11,33 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">Level of Detail - Show meshes with more or less geometry based on distance.</div>
 
+		<h2>Example</h2>
+		
+		<div>
+		[example:webgl_lod LOD]
+		</div>
+		
+		<code>
+		var lod = new THREE.LOD();
+		
+		//Create 5 levels of spheres
+		for( var i = 0; i < 5; i++ ) {
+			
+			var geometry = new THREE.IcosahedronGeometry( 10, 5 - i )
+			
+			new THREE.Mesh( geometry, material );
+			
+			lod.addLevel( mesh, i * 50 );
+			
+		}
+		</code>
 
 		<h2>Constructor</h2>
 
 
 		<h3>[name]()</h3>
-		<div>
-		todo
-		</div>
 
 
 		<h2>Properties</h2>
@@ -29,36 +46,34 @@
 
 		<h3>[property:array objects]</h3>
 		<div>
-		todo
+		An array of [page:Object3D Object3Ds]
 		</div>
 
 		<h2>Methods</h2>
 
 
 
-		<h3>[method:todo addLevel]([page:todo object], [page:todo distance])</h3>
+		<h3>[method:null addLevel]([page:Object3D mesh], [page:Float distance])</h3>
 		<div>
-		object -- todo <br />
-		distance -- todo
+		mesh -- The Object3D to display <br />
+		distance -- The distance at which to display this level of detail
 		</div>
 		<div>
-		todo
+		Adds a mesh that will display at a certain distance and greater. Typically the further away the distance,
+		the lower the detail on the mesh.
 		</div>
 
-		<h3>[method:todo getObjectForDistance]([page:todo distance])</h3>
-		<div>
-		distance -- todo
-		</div>
+		<h3>[method:Object3D getObjectForDistance]([page:Float distance])</h3>
 		<div>
-		todo
+		Get a reference to the first [page:Object3D] (mesh) that is greater than supplied distance.
 		</div>
 
-		<h3>[method:todo update]([page:todo camera])</h3>
+		<h3>[method:null update]([page:Camera camera])</h3>
 		<div>
-		camera -- todo
+		camera -- The current camera
 		</div>
 		<div>
-		todo
+		Update the visiblility of the level of detail based on the distance from the camera.
 		</div>
 
 		<h2>Source</h2>

+ 22 - 15
docs/api/objects/LensFlare.html

@@ -11,51 +11,58 @@
 		
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">Creates a simulated lens flare that tracks a light</div>
 
+		<h2>Example</h2>
+		
+		<div>[example:webgl_lensflares lensflares]</div>
 
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:todo texture], [page:todo size], [page:todo distance], [page:todo blending], [page:todo color])</h3>
+		<h3>[name]([page:Texture texture], [page:Float size], [page:Float distance], [page:Materials blending], [page:Color color])</h3>
 		<div>
-		texture -- todo <br />
-		size -- todo <br />
-		distance -- todo <br />
-		blending -- todo <br />
-		color -- todo
+		texture -- THREE.Texture (optional) <br />
+		size -- size in pixels (-1 = use texture.width) <br />
+		distance -- (0-1) from light source (0 = at light source) <br />
+		blending -- [page:Materials Blending Mode] - Defaults to THREE.NormalBlending <br />
+		color -- The color of the lens flare
 		</div>
 		<div>
-		todo
+		Automatically adds a lens flare to the lensFlares array if a texture is set.
 		</div>
 
-
 		<h2>Properties</h2>
 
 
 
 		<h3>[property:array lensFlares]</h3>
 		<div>
-		todo
+		The array of flares as set by [page:LensFlare.add]
 		</div> 
 
 		<h3>[property:Vector3 positionScreen]</h3>
 		<div>
-		todo
+		The position of the lens flare on the screen.
 		</div> 
 
-		<h3>[property:todo customUpdateCallback]</h3>
+		<h3>[property:Function customUpdateCallback]</h3>
 		<div>
-		todo
+		A custom update callback
 		</div> 
 
 		<h2>Methods</h2>
 
 
+		<h3>[method:null add]([page:Texture texture], [page:Float size], [page:Float distance], [page:Materials blending], [page:Color color])</h3>
+		<div>
+		Adds a lens flare. See the constructor for details on the parameters.
+		</div>
+
 
-		<h3>[method:todo updateLensFlares]()</h3>
+		<h3>[method:null updateLensFlares]()</h3>
 		<div>
-		todo
+		Updates the lens flare based on the [page:LensFlare.positionScreen positionScreen] property.
 		</div>
 
 		<h2>Source</h2>

+ 33 - 1
docs/api/objects/Mesh.html

@@ -42,6 +42,34 @@
 		<h3>[property:Material material]</h3>
 
 		<div>An instance of [page:Material], defining the object's appearance. Default is a [page:MeshBasicMaterial] with wireframe mode enabled and randomised colour.</div>
+		
+		<h3>[property:Array morphTargetForcedOrder]</h3>
+		
+		<div>
+		An array of indices specifying the order that the morphs will be applied. Undefined by
+		default, but reset to a blank array by [page:Mesh.updateMorphTargets updateMorphTargets].
+		</div>
+		
+		<h3>[property:Array morphTargetInfluences]</h3>
+		
+		<div>
+		An array of weights typically from 0-1 that specify how much of the morph is applied.
+		Undefined by default, but reset to a blank array by [page:Mesh.updateMorphTargets updateMorphTargets].
+		</div>
+		
+		<h3>[property:Array morphTargetDictionary]</h3>
+		
+		<div>
+		A dictionary of morphTargets based on the morphTarget.name property.
+		Undefined by default, but rebuilt [page:Mesh.updateMorphTargets updateMorphTargets].
+		</div>
+
+		<h3>[property:Integer morphTargetBase]</h3>
+		
+		<div>
+		Specify the index of the morph that should be used as the base morph. Replaces the positions.
+		Undefined by default, but reset to -1 (non set) by [page:Mesh.updateMorphTargets updateMorphTargets].
+		</div>
 
 
 		<h2>Methods</h2>
@@ -57,7 +85,11 @@
 
 		<h3>[method:null updateMorphTargets]()</h3>
 		<div>
-		Updates the morphtargets to have no influence on the object.
+		Updates the morphtargets to have no influence on the object. Resets the
+		[page:Mesh.morphTargetForcedOrder morphTargetForcedOrder],
+		[page:Mesh.morphTargetInfluences morphTargetInfluences],
+		[page:Mesh.morphTargetDictionary morphTargetDictionary], and
+		[page:Mesh.morphTargetBase morphTargetBase] properties.
 		</div>
 
 		<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>

+ 83 - 55
docs/api/objects/MorphAnimMesh.html

@@ -11,130 +11,158 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">Play a sequence of morphs in a smooth animation sequence.</div>
+
+		<h2>Examples</h2>
+		
+		<div>
+		[example:webgl_lights_hemisphere lights / hemisphere ]<br/>
+		[example:webgl_morphtargets_md2 morphtargets / md2 ]<br/>
+		[example:webgl_loader_json_blender loader / json / blender ]
+		</div>
+		
+		<code>
+		var meshAnim;
+		
+		loader.load( "models/animated/flamingo.js", function( geometry ) {
+			
+			meshAnim = new THREE.MorphAnimMesh( geometry, material );
+			meshAnim.duration = 1000;
+			scene.add( meshAnim );
+			
+		}
+		
+		function update() {
+
+			var delta = clock.getDelta();
+			meshAnim.updateAnimation( 1000 * delta );
+			
+		}
+		</code>
 
 
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:todo geometry], [page:todo material])</h3>
+		<h3>[name]([page:Geometry geometry], [page:Material material])</h3>
 		<div>
-		geometry -- todo <br />
-		material -- todo
+		geometry — An instance of [page:Geometry].<br />
+		material — An instance of [page:Material] (optional).
 		</div>
-		<div>
-		todo
-		</div>
-
 
 
 		<h2>Properties</h2>
 
 
-
-		<h3>[property:boolean directionBackwards]</h3>
+		<h3>[property:Boolean directionBackwards]</h3>
 		<div>
-		todo
+		Animation is playing backwards
 		</div>
 
-		<h3>[property:number direction]</h3>
+		<h3>[property:Float direction]</h3>
 		<div>
-		todo
+		1 if playing forward, -1 if playing backwards
 		</div>
 
-		<h3>[property:number endKeyframe]</h3>
+		<h3>[property:Integer startKeyframe]</h3>
 		<div>
-		todo
+		The first keyframe (morph) of the sequence
 		</div>
 
-		<h3>[property:boolean mirroredLoop]</h3>
+		<h3>[property:Integer endKeyframe]</h3>
 		<div>
-		todo
+		The last keyframe (morph) of the sequence
 		</div>
-
-		<h3>[property:number startKeyframe]</h3>
+		
+		<h3>[property:Boolean mirroredLoop]</h3>
 		<div>
-		todo
+		Loop animation back and forth
 		</div>
 
-		<h3>[property:number lastKeyframe]</h3>
+		<h3>[property:Integer lastKeyframe]</h3>
 		<div>
-		todo
+		The index of the last keyframe played.
 		</div>
-
-		<h3>[property:number length]</h3>
+		
+		<h3>[property:Integer currentKeyframe]</h3>
 		<div>
-		todo
+		The index of the current frame being played.
 		</div>
 
-		<h3>[property:number time]</h3>
+		<h3>[property:Integer length]</h3>
 		<div>
-		todo
+		The number of frames (morphs)
 		</div>
 
-		<h3>[property:number duration]</h3>
+		<h3>[property:Float time]</h3>
 		<div>
-		todo
+		The current playback position of the animation in milliseconds.
 		</div>
 
-		<h3>[property:number currentKeyframe]</h3>
+		<h3>[property:Float duration]</h3>
 		<div>
-		todo
+		The length of the animation in milliseconds.
 		</div>
 
 		<h2>Methods</h2>
 
 
 
-		<h3>[method:todo setDirectionForward]()</h3>
+		<h3>[method:null setDirectionForward]()</h3>
 		<div>
-		todo
+		Sets the animation to play forwards
 		</div>
 
-		<h3>[method:todo playAnimation]([page:todo label], [page:todo fps])</h3>
-		<div>
-		label -- todo <br />
-		fps -- todo
-		</div>
+		<h3>[method:null setDirectionBackward]()</h3>
 		<div>
-		todo
+		Set the animation to play backwards.
 		</div>
 
-		<h3>[method:todo setFrameRange]([page:todo start], [page:todo end])</h3>
+		<h3>[method:null playAnimation]([page:String label], [page:Float fps])</h3>
 		<div>
-		start -- todo <br />
-		end -- todo
+		label -- The label of the animation <br />
+		fps -- The frames per second (in seconds)
 		</div>
 		<div>
-		todo
+		Starts playing a labeled animation. Animations are defined by calling [page:MorphAnimMesh.parseAnimations parseAnimations].
 		</div>
 
-		<h3>[method:todo setDirectionBackward]()</h3>
+		<h3>[method:null setFrameRange]([page:Integer start], [page:Integer end])</h3>
+		<div>
+		start -- The starting frame (morph) index <br />
+		end -- The ending frame (morph) index
+		</div>
 		<div>
-		todo
+		Sets the range of morphs to be played
 		</div>
 
-		<h3>[method:todo parseAnimations]()</h3>
+		<h3>[method:null parseAnimations]()</h3>
 		<div>
-		todo
+		Goes through the geometry's morphTargets and generates animations based on the morphTargets' names (morph.name). Names
+		are of the form "walk_01", "walk_02", "walk_03", etc or "run001", "run002", "run003". The animation label is then
+		the part before the underscore and number, so "walk" or "run" in the examples.<br/><br/>
+		
+		This function changes the underlying geometry object by adding the animations property to it. This property
+		is set to an object of key/pair values, with the key being the label and the value being an object with
+		a start and end property that represents the frame index.
 		</div>
 
-		<h3>[method:todo updateAnimation]([page:todo delta])</h3>
+		<h3>[method:null updateAnimation]([page:Float delta])</h3>
 		<div>
-		delta -- todo
+		delta -- The change in time in milliseconds
 		</div>
 		<div>
-		todo
+		Update the morphTargetInfluences array on the MorphAnimMesh.
 		</div>
 
-		<h3>[method:todo setAnimationLabel]([page:todo label], [page:todo start], [page:todo end])</h3>
+		<h3>[method:null setAnimationLabel]([page:String label], [page:Integer start], [page:Integer end])</h3>
 		<div>
-		label -- todo <br />
-		start -- todo <br />
-		end -- todo
+		label -- The name of the animation <br />
+		start -- The starting frame index <br />
+		end -- The ending frame index
 		</div>
 		<div>
-		todo
+		Defines an animation. Sets the geometry.animations[label] to be an object with the start and end properties.
 		</div>
 
 		<h2>Source</h2>

+ 23 - 21
docs/api/renderers/webgl/WebGLShader.html

@@ -9,36 +9,38 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">A lower level function to compile either a vertex or fragment shader.</div>
 
 		<h2>Example</h2>
 
-		<code>todo</code>
-
-		<h2>Constructor</h2>
-
-
-		<h3>todo</h3>
-		<div></div>
+		<code>
+		var gl = renderer.context;
+		
+		var glVertexShader = new THREE.WebGLShader( gl, gl.VERTEX_SHADER, vertexSourceCode );
+		var glFragmentShader = new THREE.WebGLShader( gl, gl.FRAGMENT_SHADER, fragmentSourceCode );
+		
+		var program = gl.createProgram();
+		
+		gl.attachShader( program, glVertexShader );
+		gl.attachShader( program, glFragmentShader );
+		
+		gl.linkProgram( program );
+		</code>
 
+		<h2>Function</h2>
 
-		<h2>Properties</h2>
+		<h3>[page:WebGLShader objects]([page:WebGLContext gl], [page:WebGLEnum type], [page:String source])</h3>
 
-		<h3>todo</h3>
 		<div>
-		todo
-		</div> 
-
-
-		<h2>Methods</h2>
-		
-
-		<h3>todo</h3>
-		<div>todo</div>
+		gl -- The current WebGL context
+		type -- The WebGL type, either gl.VERTEX_SHADER or gl.FRAGMENT_SHADER
+		source -- The source code for the shader
+		</div>
 		<div>
-		todo
+		This will compile an individual shader, but won't link it to be a complete [page:WebGLProgram]. Note: this
+		is a function so the new operator should not be used.
 		</div>
-		
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]