source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/docs/api/renderers/WebGLRenderer.html@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 10.1 KB
Line 
1<!DOCTYPE html>
2<html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <script src="../../list.js"></script>
6 <script src="../../page.js"></script>
7 <link type="text/css" rel="stylesheet" href="../../page.css" />
8 </head>
9 <body>
10 <h1>[name]</h1>
11
12 <div class="desc">The WebGL renderer displays your beautifully crafted scenes using WebGL, if your device supports it.</div>
13 <div class="desc">This renderer has way better performance than [page:CanvasRenderer].</div>
14
15
16 <h2>Constructor</h2>
17
18
19 <h3>[name]( [page:Object parameters] )</h3>
20
21 <div>parameters is an optional object with properties defining the renderer's behaviour. The constructor also accepts no parameters at all. In all cases, it will assume sane defaults when parameters are missing.</div>
22
23 <div>
24 canvas — A [page:Canvas] where the renderer draws its output.<br />
25 precision — shader precision. Can be *"highp"*, *"mediump"* or *"lowp"*.<br />
26 alpha — [page:Boolean], default is *false*.<br />
27 premultipliedAlpha — [page:Boolean], default is *true*.<br />
28 antialias — [page:Boolean], default is *false*.<br />
29 stencil — [page:Boolean], default is *true*.<br />
30 preserveDrawingBuffer — [page:Boolean], default is *false*.<br />
31 maxLights — [page:Integer], default is *4*.<br />
32 </div>
33
34 <h2>Properties</h2>
35
36 <h3>.[page:DOMElement domElement]</h3>
37
38 <div>A [page:Canvas] where the renderer draws its output.<br />
39 This is automatically created by the renderer in the constructor (if not provided already); you just need to add it to your page.</div>
40
41 <h3>.[page:todo context]</h3>
42
43 <div>The HTML5 Canvas's 'webgl' context obtained from the canvas where the renderer will draw.</div>
44
45 <h3>.[page:Boolean autoClear]</h3>
46
47 <div>Defines whether the renderer should automatically clear its output before rendering.</div>
48
49
50 <h3>.[page:Boolean autoClearColor]</h3>
51
52 <div>If autoClear is true, defines whether the renderer should clear the color buffer. Default is true.</div>
53
54
55 <h3>.[page:Boolean autoClearDepth]</h3>
56
57 <div>If autoClear is true, defines whether the renderer should clear the depth buffer. Default is true.</div>
58
59
60 <h3>.[page:Boolean autoClearStencil]</h3>
61
62 <div>If autoClear is true, defines whether the renderer should clear the stencil buffer. Default is true.</div>
63
64
65 <h3>.[page:Boolean sortObjects]</h3>
66
67 <div>Defines whether the renderer should sort objects. Default is true.</div>
68
69 <div>Note: Sorting is used to attempt to properly render objects that have some degree of transparency. By definition, sorting objects may not work in all cases. Depending on the needs of application, it may be neccessary to turn off sorting and use other methods to deal with transparency rendering e.g. manually determining the object rendering order.</div>
70
71
72 <h3>.[page:Boolean autoUpdateObjects]</h3>
73
74 <div>Defines whether the renderer should auto update objects. Default is true.</div>
75
76 <div>TODO</div>
77
78 <!-- Physically based shading -->
79
80 <h3>.[page:Boolean gammaInput]</h3>
81
82 <div>Default is false. TODO</div>
83
84
85 <h3>.[page:Boolean gammaOutput]</h3>
86
87 <div>Default is false. TODO</div>
88
89
90 <h3>.[page:Boolean shadowMapEnabled]</h3>
91
92 <div>Default is false. TODO</div>
93
94
95 <h3>.[page:Boolean shadowMapAutoUpdate]</h3>
96
97 <div>Default is true. TODO</div>
98
99
100 <h3>.[page:Integer shadowMapType]</h3>
101
102 <div>Defines shadow map type (unfiltered, percentage close filtering, percentage close filtering with bilinear filtering in shader)</div>
103 <div>Options are THREE.BasicShadowMap, THREE.PCFShadowMap, THREE.PCFSoftShadowMap. Default is THREE.PCFShadowMap.</div>
104
105
106 <h3>.[page:Boolean shadowMapCullFace]</h3>
107
108 <div>Default is true. TODO</div>
109
110
111 <h3>.[page:Boolean shadowMapDebug]</h3>
112
113 <div>Default is false. TODO</div>
114
115
116 <h3>.[page:Boolean shadowMapCascade]</h3>
117
118 <div>Default is false. TODO</div>
119
120
121 <h3>.[page:Integer maxMorphTargets]</h3>
122
123 <div>Default is 8. TODO</div>
124
125
126 <h3>.[page:Integer maxMorphNormals]</h3>
127
128 <div>Default is 4. TODO</div>
129
130
131 <h3>.[page:Boolean autoScaleCubemaps]</h3>
132
133 <div>Default is true. TODO</div>
134
135
136 <h3>.[page:Boolean renderPluginsPre]</h3>
137
138 <div>An array with render plugins to be applied before rendering.</div>
139 <div>Default is an empty array, or [].</div>
140
141
142 <h3>.[page:Boolean renderPluginsPost]</h3>
143
144 <div>An array with render plugins to be applied after rendering.</div>
145 <div>Default is an empty array, or [].</div>
146
147
148 <h3>.[page:Object info]</h3>
149
150 <div>An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields:</div>
151 <div>
152 <ul>
153 <li>memory:
154 <ul>
155 <li>programs</li>
156 <li>geometries</li>
157 <li>textures</li>
158 </ul>
159 </li>
160 <li>render:
161 <ul>
162 <li>calls</li>
163 <li>vertices</li>
164 <li>faces</li>
165 <li>points</li>
166 </ul>
167 </li>
168 </ul>
169 </div>
170
171 <h3>.[page:ShadowMapPlugin shadowMapPlugin]</h3>
172 <div>
173 todo
174 </div>
175
176 <h3>.[page:number shadowMapCullFace]</h3>
177 <div>
178 todo
179 </div>
180
181 <h3>.[page:number devicePixelRatio]</h3>
182 <div>
183 todo
184 </div>
185
186 <h2>Methods</h2>
187
188 <h3>.getContext()</h3>
189 <div>
190 Return the WebGL context.
191 </div>
192
193 <h3>.supportsVertexTextures()</h3>
194 <div>
195 Return a [page:Boolean] true if the context supports vertex textures.
196 </div>
197
198
199 <h3>.setSize( [page:Integer width], [page:Integer height] )</h3>
200 <div>Resizes the output canvas to (width, height), and also sets the viewport to fit that size, starting in (0, 0).</div>
201
202 <h3>.setViewport( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
203 <div>Sets the viewport to render from (x, y) to (x + width, y + height).</div>
204
205
206 <h3>.setScissor( [page:Integer x], [page:Integer y], [page:Integer width], [page:Integer height] )</h3>
207 <div>Sets the scissor area from (x, y) to (x + width, y + height).</div>
208
209 <h3>.enableScissorTest( [page:Boolean enable] )</h3>
210 <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>
211
212 <h3>.setClearColor( [page:Color color], [page:Float alpha] )</h3>
213 <div>Sets the clear color and opacity.</div>
214
215 <code>// Creates a renderer with red background
216 var renderer = new THREE.WebGLRenderer();
217 renderer.setSize(200, 100);
218 renderer.setClearColor(0xff0000, 1);
219 </code>
220
221 <h3>.getClearColor() [page:Color]</h3>
222 <div>Returns a [page:Color THREE.Color] instance with the current clear color.</div>
223
224 <h3>.getClearAlpha() [page:Float]</h3>
225 <div>Returns a [page:Float float] with the current clear alpha. Ranges from 0 to 1.</div>
226
227 <h3>.clear( [page:Boolean color], [page:Boolean depth], [page:Boolean stencil] )</h3>
228 <div>Tells the renderer to clear its color, depth or stencil drawing buffer(s).</div>
229 <div>If no parameters are passed, no buffer will be cleared.</div>
230
231 <h3>.addPostPlugin( plugin )</h3>
232 <div>Initialises the postprocessing plugin, and adds it to the renderPluginsPost array.</div>
233
234 <h3>.addPrePlugin( plugin )</h3>
235 <div>Initialises the preprocessing plugin, and adds it to the renderPluginsPre array.</div>
236
237 <h3>.updateShadowMap( [page:Scene scene], [page:Camera camera] )</h3>
238 <div>scene — an instance of [page:Scene]<br />
239 camera — an instance of [page:Camera]</div>
240 <div>Tells the shadow map plugin to update using the passed scene and camera parameters.</div>
241
242
243 <h3>.renderBufferImmediate( [page:Object3D object], [page:??? program], [page:??? shading] )</h3>
244 <div>object — an instance of [page:Object3D]]<br />
245 program — an instance of ???<br />
246 shading — an instance of ???<br />
247 </div>
248 <div>TODO.</div>
249
250
251 <h3>.renderBufferDirect( camera, lights, fog, material, geometryGroup, object )</h3>
252 <div>TODO.</div>
253
254
255 <h3>.renderBuffer( camera, lights, fog, material, geometryGroup, object )</h3>
256 <div>TODO.</div>
257
258
259 <h3>.render( [page:Scene scene], [page:Camera camera], [page:WebGLRenderTarget renderTarget], [page:Boolean forceClear] )</h3>
260 <div>Render a scene using a camera.</div>
261 <div>The render is done to the renderTarget (if specified) or to the canvas as usual.</div>
262 <div>If forceClear is true, the canvas will be cleared before rendering, even if the renderer's autoClear property is false.</div>
263
264
265 <h3>.renderImmediateObject( camera, lights, fog, material, object )</h3>
266 <div>TODO.</div>
267
268
269 <h3>.initWebGLObjects( [page:Scene scene] )</h3>
270 <div>TODO.</div>
271
272
273 <h3>.initMaterial( material, lights, fog, object )</h3>
274 <div>TODO.</div>
275
276
277 <h3>.setFaceCulling( cullFace, frontFace )</h3>
278 <div>
279 [page:String cullFace] — "back", "front", "front_and_back", or false.<br />
280 [page:String frontFace] — "ccw" or "cw<br />
281 </div>
282 <div>Used for setting the gl frontFace, cullFace states in the GPU, thus enabling/disabling face culling when rendering.</div>
283 <div>If cullFace is false, culling will be disabled.</div>
284
285
286 <h3>.setDepthTest( depthTest )</h3>
287 <div>TODO.</div>
288
289
290 <h3>.setDepthWrite( depthWrite )</h3>
291 <div>TODO.</div>
292
293
294 <h3>.setBlending( blending, blendEquation, blendSrc, blendDst )</h3>
295 <div>TODO.</div>
296
297
298 <h3>.setTexture( texture, slot )</h3>
299 <div>TODO.</div>
300
301
302 <h3>.setRenderTarget( renderTarget )</h3>
303 <div>TODO.</div>
304
305
306
307 <h3>.supportsCompressedTextureS3TC() [page:todo]</h3>
308 <div>
309 todo
310 </div>
311
312 <h3>.getMaxAnisotropy() [page:todo]</h3>
313 <div>
314 todo
315 </div>
316
317 <h3>.getPrecision() [page:todo]</h3>
318 <div>
319 todo
320 </div>
321
322 <h3>.setMaterialFaces([page:todo material]) [page:todo]</h3>
323 <div>
324 material -- todo
325 </div>
326 <div>
327 todo
328 </div>
329
330 <h3>.supportsStandardDerivatives() [page:todo]</h3>
331 <div>
332 todo
333 </div>
334
335 <h3>.supportsFloatTextures() [page:todo]</h3>
336 <div>
337 todo
338 </div>
339
340 <h3>.clearTarget([page:todo renderTarget], [page:todo color], [page:todo depth], [page:todo stencil]) [page:todo]</h3>
341 <div>
342 renderTarget -- todo <br />
343 color -- todo <br />
344 depth -- todo <br />
345 stencil -- todo
346 </div>
347 <div>
348 todo
349 </div>
350
351 <h3>.setClearColorHex([page:todo hex], [page:todo alpha]) [page:todo]</h3>
352 <div>
353 hex -- todo <br />
354 alpha -- todo
355 </div>
356 <div>
357 todo
358 </div>
359
360 <h2>Source</h2>
361
362 [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
363 </body>
364</html>
Note: See TracBrowser for help on using the repository browser.