Sfoglia il codice sorgente

Merge pull request #5731 from TatumCreative/docs-renderers

Renderer docs
Mr.doob 10 anni fa
parent
commit
48c2a37e27

+ 39 - 13
docs/api/cameras/CubeCamera.html

@@ -11,20 +11,46 @@
 
 		<h1>[name]</h1>
 
-		<div class="desc">Camera with cube projection</div>
-
+		<div class="desc">Creates 6 cameras that render to a [page:WebGLRenderTargetCube].</div>
+
+		<h2>Examples</h2>
+		
+		<div>[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]</div>
+		<div>[example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2 ]</div>
+		<div>[example:webgl_materials_cubemap_dynamic2 shading / physical ]</div>
+		
+		<code>//Create cube camera
+		var cubeCamera = new THREE.CubeCamera( 1, 100000, 128 );
+		scene.add( cubeCamera );
+		
+		//Create car
+		var chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, ambient: 0xffffff, envMap: cubeCamera.renderTarget } );
+		var car = new Mesh( carGeometry, chromeMaterial );
+		scene.add( car );
+		
+		//Update the render target cube
+		car.setVisible( false );
+		cubeCamera.position.copy( car.position );
+		cubeCamera.updateCubeMap( renderer, scene );
+
+		//Render the scene
+		car.setVisible( true );
+		renderer.render( scene, camera );
+		</code>
+		
 
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Float near], [page:Float far], [page:Float cubeResolution])</h3>
+		<h3>[name]([page:number near], [page:number far], [page:number cubeResolution])</h3>
 		<div>
-		near -- Camera frustum near plane. <br />
-		far -- Camera frustum far plane. <br />
-		cubeResolution -- The size of the render target image.
+		near -- The near clipping distance. <br />
+		far -- The far clipping distance <br />
+		cubeResolution -- Sets the width of the cube.
 		</div>
 		<div>
-		todo
+		Constructs a CubeCamera that contains 6 [page:PerspectiveCamera PerspectiveCameras] that then
+		render to a [page:WebGLRenderTargetCube]
 		</div>
 
 
@@ -34,20 +60,20 @@
 
 		<h3>[property:WebGLRenderTargetCube renderTarget]</h3>
 		<div>
-		The camera renders to this target.
-		</div>
+		The cube texture that gets generated.
+		</div> 
 
 		<h2>Methods</h2>
 
 
 
-		<h3>[method:todo updateCubeMap]([page:WebGLRenderer], [page:Scene])</h3>
+		<h3>[method:todo updateCubeMap]([page:todo renderer], [page:todo scene])</h3>
 		<div>
-		renderer -- The renderer to use for this camera. <br />
-		scene -- The scene to render.
+		renderer -- The current WebGL renderer <br />
+		scene -- The current scene
 		</div>
 		<div>
-		todo
+		Call this to update the renderTarget.
 		</div>
 
 		<h2>Source</h2>

+ 25 - 19
docs/api/renderers/CanvasRenderer.html

@@ -98,12 +98,7 @@
 		<h2>Methods</h2>
 
 
-		<h3>[method:number getMaxAnisotropy]()</h3>
-		<div>
-		This returns the anisotropy level of the textures.
-		</div>
-
-		<h3>[method:todo render]( [page:Scene scene], [page:Camera camera])</h3>
+		<h3>[method:null render]( [page:Scene scene], [page:Camera camera])</h3>
 		<div>
 		scene -- The scene to render. <br />
 		camera -- the camera to view the scene.
@@ -112,12 +107,12 @@
         Render a scene using a camera.
 		</div>
 
-		<h3>[method:todo clear]()</h3>
+		<h3>[method:null clear]()</h3>
 		<div>
 		Tells the renderer to clear its color drawing buffer with the clearcolor.
 		</div>
 
-		<h3>[method:todo setClearColor]([page:Color color], [page:number alpha])</h3>
+		<h3>[method:null setClearColor]([page:Color color], [page:number alpha])</h3>
 		<div>
 		color -- The color to clear the canvas with. <br />
 		alpha -- The alpha channel to clear the canvas with.
@@ -126,17 +121,8 @@
 		This set the clearColor and the clearAlpha.
 		</div>
 
-		<h3>[method:todo setFaceCulling]()</h3>
-		<div>
-		Empty function to keep compability with [page:WebglRenderer].
-		</div>
 
-		<h3>[method:todo supportsVertexTextures]()</h3>
-		<div>
-		Empty function to keep compability with [page:WebglRenderer].
-		</div>
-
-		<h3>[method:todo setSize]([page:Number width], [page:Number height], [page:boolean updateStyle])</h3>
+		<h3>[method:null setSize]([page:Number width], [page:Number height], [page:boolean updateStyle])</h3>
 		<div>
 		width -- The width of the drawing canvas. <br />
 		height -- The height of the drawing canvas. <br />
@@ -146,7 +132,7 @@
 		This set the size of the drawing canvas and if updateStyle is set, then the css of the canvas is updated too.
 		</div>
 
-		<h3>[method:todo setClearColorHex]([page:number hex], [page:number alpha])</h3>
+		<h3>[method:null setClearColorHex]([page:number hex], [page:number alpha])</h3>
 		<div>
 		hex -- The the hexadecimal value of the color to clear the canvas with. <br />
         alpha -- The alpha channel to clear the canvas with.
@@ -154,6 +140,26 @@
 		<div>
 		This set the clearColor and the clearAlpha.
 		</div>
+		
+		<h3>[method:number getClearColorHex]()</h3>
+		<div>
+		Returns the [page:number hex] color.
+		</div>
+		
+		<h3>[method:number getClearAlpha]()</h3>
+		<div>
+		Returns the alpha value.
+		</div>
+		
+		<h2>Empty Methods to Maintain Compatibility with [page:WebglRenderer]</h2>
+		<div>
+			[method:null clearColor]()<br/>
+			[method:null clearDepth]()<br/>
+			[method:null clearStencil]()<br/>
+			[method:null setFaceCulling]()<br/>
+			[method:null supportsVertexTextures]()<br/>
+			[method:number getMaxAnisotropy]() - returns 1 <br/>
+		</div>
 
 		<h2>Source</h2>
 

+ 84 - 1
docs/api/renderers/WebGLRenderTarget.html

@@ -19,7 +19,7 @@
 		<div>
 		width -- The width of the renderTarget. <br />
 		height -- The height of the renderTarget. <br />
-		options -- The options of the renderTarget. They are alot like the options of a texture.
+		options -- The options sets the properties of the render target.
 		</div>
 		<div>
 		Creates a new renderTarget with a certain width and height.
@@ -27,9 +27,92 @@
 
 		<h2>Properties</h2>
 
+		<h3>[property:number wrapS]</h3>
+		<div>
+		The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
+		</div>
 
+		<h3>[property:number wrapT]</h3>
+		<div>
+		The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
+		</div>
+		
+		<h3>[property:number magFilter]</h3>
+		<div>
+		How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them. The other option is THREE.NearestFilter, which uses the value of the closest texel.
+		</div>
 
+		<h3>[property:number minFilter]</h3>
+		<div>
+		How the texture is sampled when a texel covers less than one pixel. The default is THREE.LinearMipMapLinearFilter, which uses mipmapping and a trilinear filter. Other choices are THREE.NearestFilter, THREE.NearestMipMapNearestFilter, THREE.NearestMipMapLinearFilter, THREE.LinearFilter, and THREE.LinearMipMapNearestFilter. These vary whether the nearest texel or nearest four texels are retrieved on the nearest mipmap or nearest two mipmaps. Interpolation occurs among the samples retrieved.
+		</div>
+		
+		<h3>[property:number anisotropy]</h3>
+		<div>
+		The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.
+		</div>
+		
+		<h3>[property:Vector2 repeat]</h3>
+		<div>
+		How many times the texture is repeated across the surface, in each direction U and V.
+		</div>
+
+		<h3>[property:Vector2 offset]</h3>
+		<div>
+		How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is 0.0 to 1.0.
+		</div>
+		
+		<h3>[property:number format]</h3>
+		<div>
+		The default is THREE.RGBAFormat for the texture. Other formats are: THREE.AlphaFormat, THREE.RGBFormat, THREE.LuminanceFormat, and THREE.LuminanceAlphaFormat. There are also compressed texture formats, if the S3TC extension is supported: THREE.RGB_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT3_Format, and THREE.RGBA_S3TC_DXT5_Format.
+		</div>
+
+		<h3>[property:number type]</h3>
+		<div>
+		The default is THREE.UnsignedByteType. Other valid types (as WebGL allows) are THREE.ByteType, THREE.ShortType, THREE.UnsignedShortType, THREE.IntType, THREE.UnsignedIntType, THREE.FloatType, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type, and THREE.UnsignedShort565Type.
+		</div>
+		
+		<h3>[property:boolean depthBuffer]</h3>
+		<div>
+		Renders to the depth buffer. Default is true.
+		</div>
+		
+		<h3>[property:boolean stencilBuffer]</h3>
+		<div>
+		Renders to the stencil buffer. Default is true.
+		</div>
+
+		<h3>[property:boolean generateMipmaps]</h3>
+		<div>
+		Whether to generate mipmaps (if possible) for a texture. True by default.
+		</div>
+
+		<h3>[property:WebGLRenderTarget shareDepthFrom]</h3>
+		<div>
+		Shares the depth from another WebGLRenderTarget. Default is null.
+		</div>
+
+		
 		<h2>Methods</h2>
+		
+		<h3>[method:null setSize]( [page:Number width], [page:Number height] )</h3>
+		<div>
+		Sets the size of the renderTarget.
+		</div>
+		
+		<h3>[method:RenderTarget clone]()</h3>
+		<div>
+		Creates a copy of the render target.
+		</div>
+		
+		<h3>[method:null dispose]()</h3>
+		<div>
+		Dispatches a dispose event.
+		</div>
+		
+		
+		
+		
 
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 

+ 19 - 11
docs/api/renderers/WebGLRenderTargetCube.html

@@ -7,34 +7,42 @@
 		<link type="text/css" rel="stylesheet" href="../../page.css" />
 	</head>
 	<body>
+		[page:WebGLRenderTarget] &rarr;
+		
 		<h1>[name]</h1>
 
-		<div class="desc">todo</div>
+		<div class="desc">[page:CubeCamera] uses this as its [page:WebGLRenderTarget]</div>
+
+		<h2>Examples</h2>
+		
+		<div>See [page:CubeCamera] for examples.</div>
 
 
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:todo width], [page:todo height], [page:todo options])</h3>
-		<div>
-		width -- todo <br />
-		height -- todo <br />
-		options -- todo
-		</div>
+		<h3>[name]([page:Number width], [page:Number height], [page:Object options])</h3>
 		<div>
-		todo
+		width -- The width of the renderTarget. <br />
+		height -- The height of the renderTarget. <br />
+		options -- The options sets the properties of the render target.
 		</div>
 
 
-		<h3>[name]()</h3>
-
-
 		<h2>Properties</h2>
 
+		<h3>[property:integer activeCubeFace]</h3>
+		<div>
+		The activeCubeFace property corresponds to a cube side (PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5) and is
+		used and set internally by the [page:CubeCamera].
+		</div>
+
+		<h3>See [page:WebGLRenderTarget] for inherited properties</h3>
 
 
 		<h2>Methods</h2>
 
+		<h3>See [page:WebGLRenderTarget] for inherited methods</h3>
 
 
 		<h2>Source</h2>

+ 21 - 41
docs/api/renderers/WebGLRenderer.html

@@ -160,31 +160,31 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:todo getContext]()</h3>
+		<h3>[method:WebGLRenderingContext getContext]()</h3>
 		<div>
 		Return the WebGL context.
 		</div>
 
-		<h3>[method:todo supportsVertexTextures]()</h3>
+		<h3>[method:Boolean supportsVertexTextures]()</h3>
 		<div>
 		Return a [page:Boolean] true if the context supports vertex textures.
 		</div>
 
 
-		<h3>[method:todo setSize]( [page:Integer width], [page:Integer height] )</h3>
+		<h3>[method:null setSize]( [page:Integer width], [page:Integer height] )</h3>
 		<div>Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0).</div>
 
-		<h3>[method:todo setViewport]( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
+		<h3>[method:null setViewport]( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
 		<div>Sets the viewport to render from (x, y) to (x + width, y + height).</div>
 
 
-		<h3>[method:todo setScissor]( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
+		<h3>[method:null setScissor]( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
 		<div>Sets the scissor area from (x, y) to (x + width, y + height).</div>
 
-		<h3>[method:todo enableScissorTest]( [page:Boolean enable] )</h3>
+		<h3>[method:null enableScissorTest]( [page:Boolean enable] )</h3>
 		<div>Enable the scissor test. When this is enabled, only the pixels within the defined scissor area will be affected by further renderer actions.</div>
 
-		<h3>[method:todo setClearColor]( [page:Color color], [page:Float alpha] )</h3>
+		<h3>[method:null setClearColor]( [page:Color color], [page:Float alpha] )</h3>
 		<div>Sets the clear color and opacity.</div>
 
 		<code>// Creates a renderer with red background
@@ -199,11 +199,11 @@
 		<h3>[method:Float getClearAlpha]()</h3>
 		<div>Returns a [page:Float float] with the current clear alpha. Ranges from 0 to 1.</div>
 
-		<h3>[method:todo clear]( [page:Boolean color], [page:Boolean depth], [page:Boolean stencil] )</h3>
+		<h3>[method:null clear]( [page:Boolean color], [page:Boolean depth], [page:Boolean stencil] )</h3>
 		<div>Tells the renderer to clear its color, depth or stencil drawing buffer(s).</div>
 		<div>Arguments default to true.</div>
 
-		<h3>[method:todo renderBufferImmediate]( [page:Object3D object], [page:shaderprogram program], [page:Material shading] )</h3>
+		<h3>[method:null renderBufferImmediate]( [page:Object3D object], [page:shaderprogram program], [page:Material shading] )</h3>
 		<div>object — an instance of [page:Object3D]]<br />
 		program — an instance of shaderProgram<br />
 		shading — an instance of Material<br />
@@ -213,45 +213,25 @@
 		</div>
 
 
-		<h3>[method:todo renderBufferDirect]( [page:Camera camera], [page:Array lights], [page:Fog fog], [page:Material material], [page:Object geometryGroup], [page:Object3D object] )</h3>
+		<h3>[method:null renderBufferDirect]( [page:Camera camera], [page:Array lights], [page:Fog fog], [page:Material material], [page:Object geometryGroup], [page:Object3D object] )</h3>
 		<div>Render a buffer geometry group using the camera and with the correct material.</div>
 
 
-		<h3>[method:todo renderBuffer]( [page:Camera camera], [page:Array lights], [page:Fog fog], [page:Material material], [page:Object geometryGroup], [page:Object3D object] )</h3>
+		<h3>[method:null renderBuffer]( [page:Camera camera], [page:Array lights], [page:Fog fog], [page:Material material], [page:Object geometryGroup], [page:Object3D object] )</h3>
 		<div>Render a geometry group using the camera and with the correct material.</div>
 
 
-		<h3>[method:todo render]( [page:Scene scene], [page:Camera camera], [page:WebGLRenderTarget renderTarget], [page:Boolean forceClear] )</h3>
+		<h3>[method:null render]( [page:Scene scene], [page:Camera camera], [page:WebGLRenderTarget renderTarget], [page:Boolean forceClear] )</h3>
 		<div>Render a scene using a camera.</div>
 		<div>The render is done to the renderTarget (if specified) or to the canvas as usual.</div>
 		<div>If forceClear is true, the depth, stencil and color buffers will be cleared before rendering even if the renderer's autoClear property is false.</div>
 		<div>Even with forceClear set to true you can prevent certain buffers being cleared by setting either the .autoClearColor, .autoClearStencil or .autoClearDepth properties to false.</div>
 
-		<h3>[method:todo renderImmediateObject]( camera, lights, fog, material, object )</h3>
+		<h3>[method:null renderImmediateObject]( camera, lights, fog, material, object )</h3>
 		<div>Renders an immediate Object using a camera.</div>
 
 
-		<h3>[method:todo initWebGLObjects]( [page:Scene scene] )</h3>
-		<div>
-		[page:Scene scene] -- The scene to initialize.
-		</div>
-		<div>
-		This method initializes the scene. This means adding and removing all objects from the scene and updating them to make sure we have the correct webgl buffers. 
-		</div>
-
-
-		<h3>[method:todo initMaterial]( [page:Material material], [page:Array lights], [page:Fog fog], [page:Object3D object])</h3>
-		<div>
-		[page:Material material] -- The material to initialize.<br />
-		[page:Array lights] -- An array of lights that influence the material.<br />
-		[page:Fog fog] -- The fog of the scene.<br />
-		[page:Object3D object] -- The object of the material that needs init.
-		</div>
-		<div>
-		This method initializes the material as a webgl program to be used.
-		</div>
-
-		<h3>[method:todo setFaceCulling]( cullFace, frontFace )</h3>
+		<h3>[method:null setFaceCulling]( cullFace, frontFace )</h3>
 		<div>
 		[page:String cullFace] —- "back", "front", "front_and_back", or false.<br />
 		[page:String frontFace] —- "ccw" or "cw<br />
@@ -260,7 +240,7 @@
 		<div>If cullFace is false, culling will be disabled.</div>
 
 
-		<h3>[method:todo setDepthTest]( [page:boolean depthTest] )</h3>
+		<h3>[method:null setDepthTest]( [page:boolean depthTest] )</h3>
 		<div>
 		depthTest -- The boolean to decide if depth of a fragment needs to be tested against the depth buffer . <br />
 		</div>
@@ -268,7 +248,7 @@
 		This sets, based on depthTest, whether or not the depth data needs to be tested against the depth buffer.
 		</div>
 
-		<h3>[method:todo setDepthWrite]( [page:boolean depthWrite] )</h3>
+		<h3>[method:null setDepthWrite]( [page:boolean depthWrite] )</h3>
 		<div>
 		depthWrite -- The boolean to decide if depth of a fragment needs to be kept. <br />
 		</div>
@@ -277,7 +257,7 @@
 		</div>
 
 
-		<h3>[method:todo setBlending]( [page:number blending], [page:number blendEquation], [page:number blendSrc], [page:number blendDst] )</h3>
+		<h3>[method:null setBlending]( [page:number blending], [page:number blendEquation], [page:number blendSrc], [page:number blendDst] )</h3>
 		<div>
 		blending -- A number indicating the blending mode. Possible value are THREE.NoBlending, THREE.NormalBlending, THREE.AdditiveBlending, THREE.SubtractiveBlending, THREE.MultiplyBlending or THREE.CustomBlending <br />
 		blendEquation -- When blending is THREE.CustomBlending, then you can set the blendEquation. Possible values are THREE.AddEquation, THREE.SubtractEquation or THREE.ReverseSubtractEquation.<br />
@@ -288,7 +268,7 @@
 		This method sets the correct blending.
 		</div>
 		
-		<h3>[method:todo setTexture]( [page:Texture texture], [page:number slot] )</h3>
+		<h3>[method:null setTexture]( [page:Texture texture], [page:number slot] )</h3>
 		<div>
 		texture -- The [page:Texture texture] that needs to be set.<br />
 		slot -- The number indicating which slot should be used by the texture.
@@ -297,7 +277,7 @@
 		This method sets the correct texture to the correct slot for the wegl shader. The slot number can be found as a value of the uniform of the sampler.
 		</div>
 		
-		<h3>[method:todo setRenderTarget]( [page:WebGLRenderTarget renderTarget] )</h3>
+		<h3>[method:null setRenderTarget]( [page:WebGLRenderTarget renderTarget] )</h3>
 		<div>
 		renderTarget -- The [page:WebGLRenderTarget renderTarget] that needs to be activated.<br />
 		</div>
@@ -320,7 +300,7 @@
 		This gets the precision used by the shaders. It returns "highp","mediump" or "lowp".
 		</div>
 
-		<h3>[method:todo setMaterialFaces]([page:Material material])</h3>
+		<h3>[method:null setMaterialFaces]([page:Material material])</h3>
 		<div>
 		material -- The [page:Material material] with side that shouldn't be culled.  
 		</div>
@@ -338,7 +318,7 @@
 		This method returns true if the webgl implementation supports float textures.
 		</div>
 
-		<h3>[method:todo clearTarget]([page:WebGLRenderTarget renderTarget], [page:boolean color], [page:boolean depth], [page:boolean stencil])</h3>
+		<h3>[method:null clearTarget]([page:WebGLRenderTarget renderTarget], [page:boolean color], [page:boolean depth], [page:boolean stencil])</h3>
 		<div>
 		renderTarget -- The [page:WebGLRenderTarget renderTarget] that needs to be cleared.<br />
 		color -- If set, then the color gets cleared. <br />