WebGLRenderer.html 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>WebGLRenderer - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <h1 translate="no">WebGLRenderer</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>This renderer uses WebGL 2 to display scenes.</p>
  16. <p>WebGL 1 is not supported since <code>r163</code>.</p></div>
  17. </header>
  18. <article>
  19. <div class="container-overview">
  20. <h2>Constructor</h2>
  21. <h3 class="name name-method" id="WebGLRenderer" translate="no">new <a href="#WebGLRenderer">WebGLRenderer</a><span class="signature">( parameters : <span class="param-type"><a href="WebGLRenderer.html#~Options">WebGLRenderer~Options</a></span> )</span> </h3>
  22. <div class="method">
  23. <div class="description">
  24. <p>Constructs a new WebGL renderer.</p>
  25. </div>
  26. <table class="params">
  27. <tbody>
  28. <tr>
  29. <td class="name">
  30. <strong>parameters</strong>
  31. </td>
  32. <td class="description last">
  33. <p>The configuration parameter.</p>
  34. </td>
  35. </tr>
  36. </tbody>
  37. </table>
  38. </div>
  39. </div>
  40. <h2 class="subsection-title">Properties</h2>
  41. <div class="member">
  42. <h3 class="name" id="autoClear" translate="no">.<a href="#autoClear">autoClear</a><span class="type-signature"> : boolean</span> </h3>
  43. <div class="description">
  44. <p>Whether the renderer should automatically clear its output before rendering a frame or not.</p>
  45. <p>Default is <code>true</code>.</p>
  46. </div>
  47. </div>
  48. <div class="member">
  49. <h3 class="name" id="autoClearColor" translate="no">.<a href="#autoClearColor">autoClearColor</a><span class="type-signature"> : boolean</span> </h3>
  50. <div class="description">
  51. <p>If <a href="WebGLRenderer.html#autoClear">WebGLRenderer#autoClear</a> set to <code>true</code>, whether the renderer should clear
  52. the color buffer or not.</p>
  53. <p>Default is <code>true</code>.</p>
  54. </div>
  55. </div>
  56. <div class="member">
  57. <h3 class="name" id="autoClearDepth" translate="no">.<a href="#autoClearDepth">autoClearDepth</a><span class="type-signature"> : boolean</span> </h3>
  58. <div class="description">
  59. <p>If <a href="WebGLRenderer.html#autoClear">WebGLRenderer#autoClear</a> set to <code>true</code>, whether the renderer should clear
  60. the depth buffer or not.</p>
  61. <p>Default is <code>true</code>.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="autoClearStencil" translate="no">.<a href="#autoClearStencil">autoClearStencil</a><span class="type-signature"> : boolean</span> </h3>
  66. <div class="description">
  67. <p>If <a href="WebGLRenderer.html#autoClear">WebGLRenderer#autoClear</a> set to <code>true</code>, whether the renderer should clear
  68. the stencil buffer or not.</p>
  69. <p>Default is <code>true</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="capabilities" translate="no">.<a href="#capabilities">capabilities</a><span class="type-signature"> : <a href="WebGLRenderer.html#~Capabilities">WebGLRenderer~Capabilities</a></span> </h3>
  74. <div class="description">
  75. <p>Holds details about the capabilities of the current rendering context.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="clippingPlanes" translate="no">.<a href="#clippingPlanes">clippingPlanes</a><span class="type-signature"> : Array.&lt;<a href="Plane.html">Plane</a>></span> </h3>
  80. <div class="description">
  81. <p>User-defined clipping planes specified in world space. These planes apply globally.
  82. Points in space whose dot product with the plane is negative are cut away.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="coordinateSystem" translate="no">.<a href="#coordinateSystem">coordinateSystem</a><span class="type-signature"> : <a href="global.html#WebGLCoordinateSystem">WebGLCoordinateSystem</a> | <a href="global.html#WebGPUCoordinateSystem">WebGPUCoordinateSystem</a></span> <span class="type-signature">(readonly) </span></h3>
  87. <div class="description">
  88. <p>Defines the coordinate system of the renderer.</p>
  89. <p>In <code>WebGLRenderer</code>, the value is always <code>WebGLCoordinateSystem</code>.</p>
  90. <p>Default is <code>WebGLCoordinateSystem</code>.</p>
  91. </div>
  92. </div>
  93. <div class="member">
  94. <h3 class="name" id="debug" translate="no">.<a href="#debug">debug</a><span class="type-signature"> : Object</span> </h3>
  95. <div class="description">
  96. <p>A object with debug configuration settings.</p>
  97. <ul>
  98. <li><code>checkShaderErrors</code>: If it is <code>true</code>, defines whether material shader programs are
  99. checked for errors during compilation and linkage process. It may be useful to disable
  100. this check in production for performance gain. It is strongly recommended to keep these
  101. checks enabled during development. If the shader does not compile and link - it will not
  102. work and associated material will not render.</li>
  103. <li><code>onShaderError(gl, program, glVertexShader,glFragmentShader)</code>: A callback function that
  104. can be used for custom error reporting. The callback receives the WebGL context, an instance
  105. of WebGLProgram as well two instances of WebGLShader representing the vertex and fragment shader.
  106. Assigning a custom function disables the default error reporting.</li>
  107. </ul>
  108. </div>
  109. </div>
  110. <div class="member">
  111. <h3 class="name" id="domElement" translate="no">.<a href="#domElement">domElement</a><span class="type-signature"> : HTMLCanvasElement | OffscreenCanvas</span> </h3>
  112. <div class="description">
  113. <p>A canvas where the renderer draws its output.This is automatically created by the renderer
  114. in the constructor (if not provided already); you just need to add it to your page like so:</p>
  115. <pre><code class="language-js">document.body.appendChild( renderer.domElement );
  116. </code></pre>
  117. </div>
  118. </div>
  119. <div class="member">
  120. <h3 class="name" id="extensions" translate="no">.<a href="#extensions">extensions</a><span class="type-signature"> : Object</span> </h3>
  121. <div class="description">
  122. <p>Provides methods for retrieving and testing WebGL extensions.</p>
  123. <ul>
  124. <li><code>get(extensionName:string)</code>: Used to check whether a WebGL extension is supported
  125. and return the extension object if available.</li>
  126. <li><code>has(extensionName:string)</code>: returns <code>true</code> if the extension is supported.</li>
  127. </ul>
  128. </div>
  129. </div>
  130. <div class="member">
  131. <h3 class="name" id="info" translate="no">.<a href="#info">info</a><span class="type-signature"> : <a href="WebGLRenderer.html#~Info">WebGLRenderer~Info</a></span> </h3>
  132. <div class="description">
  133. <p>Holds a series of statistical information about the GPU memory
  134. and the rendering process. Useful for debugging and monitoring.</p>
  135. <p>By default these data are reset at each render call but when having
  136. multiple render passes per frame (e.g. when using post processing) it can
  137. be preferred to reset with a custom pattern. First, set <code>autoReset</code> to
  138. <code>false</code>.</p>
  139. <pre><code class="language-js">renderer.info.autoReset = false;
  140. </code></pre>
  141. <p>Call <code>reset()</code> whenever you have finished to render a single frame.</p>
  142. <pre><code class="language-js">renderer.info.reset();
  143. </code></pre>
  144. </div>
  145. </div>
  146. <div class="member">
  147. <h3 class="name" id="isWebGLRenderer" translate="no">.<a href="#isWebGLRenderer">isWebGLRenderer</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  148. <div class="description">
  149. <p>This flag can be used for type testing.</p>
  150. <p>Default is <code>true</code>.</p>
  151. </div>
  152. </div>
  153. <div class="member">
  154. <h3 class="name" id="localClippingEnabled" translate="no">.<a href="#localClippingEnabled">localClippingEnabled</a><span class="type-signature"> : boolean</span> </h3>
  155. <div class="description">
  156. <p>Whether the renderer respects object-level clipping planes or not.</p>
  157. <p>Default is <code>false</code>.</p>
  158. </div>
  159. </div>
  160. <div class="member">
  161. <h3 class="name" id="outputColorSpace" translate="no">.<a href="#outputColorSpace">outputColorSpace</a><span class="type-signature"> : <a href="global.html#SRGBColorSpace">SRGBColorSpace</a> | <a href="global.html#LinearSRGBColorSpace">LinearSRGBColorSpace</a></span> </h3>
  162. <div class="description">
  163. <p>Defines the output color space of the renderer.</p>
  164. <p>Default is <code>SRGBColorSpace</code>.</p>
  165. </div>
  166. </div>
  167. <div class="member">
  168. <h3 class="name" id="properties" translate="no">.<a href="#properties">properties</a><span class="type-signature"> : Object</span> </h3>
  169. <div class="description">
  170. <p>Used to track properties of other objects like native WebGL objects.</p>
  171. </div>
  172. </div>
  173. <div class="member">
  174. <h3 class="name" id="renderLists" translate="no">.<a href="#renderLists">renderLists</a><span class="type-signature"> : Object</span> </h3>
  175. <div class="description">
  176. <p>Manages the render lists of the renderer.</p>
  177. </div>
  178. </div>
  179. <div class="member">
  180. <h3 class="name" id="shadowMap" translate="no">.<a href="#shadowMap">shadowMap</a><span class="type-signature"> : <a href="WebGLRenderer.html#~ShadowMap">WebGLRenderer~ShadowMap</a></span> </h3>
  181. <div class="description">
  182. <p>Interface for managing shadows.</p>
  183. </div>
  184. </div>
  185. <div class="member">
  186. <h3 class="name" id="sortObjects" translate="no">.<a href="#sortObjects">sortObjects</a><span class="type-signature"> : boolean</span> </h3>
  187. <div class="description">
  188. <p>Whether the renderer should sort objects or not.</p>
  189. <p>Note: Sorting is used to attempt to properly render objects that have some
  190. degree of transparency. By definition, sorting objects may not work in all
  191. cases. Depending on the needs of application, it may be necessary to turn
  192. off sorting and use other methods to deal with transparency rendering e.g.
  193. manually determining each object's rendering order.</p>
  194. <p>Default is <code>true</code>.</p>
  195. </div>
  196. </div>
  197. <div class="member">
  198. <h3 class="name" id="state" translate="no">.<a href="#state">state</a><span class="type-signature"> : Object</span> </h3>
  199. <div class="description">
  200. <p>Interface for managing the WebGL state.</p>
  201. </div>
  202. </div>
  203. <div class="member">
  204. <h3 class="name" id="toneMapping" translate="no">.<a href="#toneMapping">toneMapping</a><span class="type-signature"> : <a href="global.html#NoToneMapping">NoToneMapping</a> | <a href="global.html#LinearToneMapping">LinearToneMapping</a> | <a href="global.html#ReinhardToneMapping">ReinhardToneMapping</a> | <a href="global.html#CineonToneMapping">CineonToneMapping</a> | <a href="global.html#ACESFilmicToneMapping">ACESFilmicToneMapping</a> | <a href="global.html#CustomToneMapping">CustomToneMapping</a> | <a href="global.html#AgXToneMapping">AgXToneMapping</a> | <a href="global.html#NeutralToneMapping">NeutralToneMapping</a></span> </h3>
  205. <div class="description">
  206. <p>The tone mapping technique of the renderer.</p>
  207. <p>Default is <code>NoToneMapping</code>.</p>
  208. </div>
  209. </div>
  210. <div class="member">
  211. <h3 class="name" id="toneMappingExposure" translate="no">.<a href="#toneMappingExposure">toneMappingExposure</a><span class="type-signature"> : number</span> </h3>
  212. <div class="description">
  213. <p>Exposure level of tone mapping.</p>
  214. <p>Default is <code>1</code>.</p>
  215. </div>
  216. </div>
  217. <div class="member">
  218. <h3 class="name" id="transmissionResolutionScale" translate="no">.<a href="#transmissionResolutionScale">transmissionResolutionScale</a><span class="type-signature"> : number</span> </h3>
  219. <div class="description">
  220. <p>The normalized resolution scale for the transmission render target, measured in percentage
  221. of viewport dimensions. Lowering this value can result in significant performance improvements
  222. when using <a href="MeshPhysicalMaterial.html#transmission">MeshPhysicalMaterial#transmission</a>.</p>
  223. <p>Default is <code>1</code>.</p>
  224. </div>
  225. </div>
  226. <div class="member">
  227. <h3 class="name" id="xr" translate="no">.<a href="#xr">xr</a><span class="type-signature"> : <a href="WebXRManager.html">WebXRManager</a></span> </h3>
  228. <div class="description">
  229. <p>A reference to the XR manager.</p>
  230. </div>
  231. </div>
  232. <h2 class="subsection-title">Methods</h2>
  233. <h3 class="name name-method" id="clear" translate="no">.<a href="#clear">clear</a><span class="signature">( color : <span class="param-type">boolean</span>, depth : <span class="param-type">boolean</span>, stencil : <span class="param-type">boolean</span> )</span> </h3>
  234. <div class="method">
  235. <div class="description">
  236. <p>Tells the renderer to clear its color, depth or stencil drawing buffer(s).
  237. This method initializes the buffers to the current clear color values.</p>
  238. </div>
  239. <table class="params">
  240. <tbody>
  241. <tr>
  242. <td class="name">
  243. <strong>color</strong>
  244. </td>
  245. <td class="description last">
  246. <p>Whether the color buffer should be cleared or not.</p>
  247. <p>Default is <code>true</code>.</p>
  248. </td>
  249. </tr>
  250. <tr>
  251. <td class="name">
  252. <strong>depth</strong>
  253. </td>
  254. <td class="description last">
  255. <p>Whether the depth buffer should be cleared or not.</p>
  256. <p>Default is <code>true</code>.</p>
  257. </td>
  258. </tr>
  259. <tr>
  260. <td class="name">
  261. <strong>stencil</strong>
  262. </td>
  263. <td class="description last">
  264. <p>Whether the stencil buffer should be cleared or not.</p>
  265. <p>Default is <code>true</code>.</p>
  266. </td>
  267. </tr>
  268. </tbody>
  269. </table>
  270. </div>
  271. <h3 class="name name-method" id="clearColor" translate="no">.<a href="#clearColor">clearColor</a><span class="signature">()</span> </h3>
  272. <div class="method">
  273. <div class="description">
  274. <p>Clears the color buffer. Equivalent to calling <code>renderer.clear( true, false, false )</code>.</p>
  275. </div>
  276. </div>
  277. <h3 class="name name-method" id="clearDepth" translate="no">.<a href="#clearDepth">clearDepth</a><span class="signature">()</span> </h3>
  278. <div class="method">
  279. <div class="description">
  280. <p>Clears the depth buffer. Equivalent to calling <code>renderer.clear( false, true, false )</code>.</p>
  281. </div>
  282. </div>
  283. <h3 class="name name-method" id="clearStencil" translate="no">.<a href="#clearStencil">clearStencil</a><span class="signature">()</span> </h3>
  284. <div class="method">
  285. <div class="description">
  286. <p>Clears the stencil buffer. Equivalent to calling <code>renderer.clear( false, false, true )</code>.</p>
  287. </div>
  288. </div>
  289. <h3 class="name name-method" id="compile" translate="no">.<a href="#compile">compile</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, targetScene : <span class="param-type"><a href="Scene.html">Scene</a></span> )</span><span class="type-signature"> : Set.&lt;<a href="Material.html">Material</a>></span> </h3>
  290. <div class="method">
  291. <div class="description">
  292. <p>Compiles all materials in the scene with the camera. This is useful to precompile shaders
  293. before the first rendering. If you want to add a 3D object to an existing scene, use the third
  294. optional parameter for applying the target scene.</p>
  295. <p>Note that the (target) scene's lighting and environment must be configured before calling this method.</p>
  296. </div>
  297. <table class="params">
  298. <tbody>
  299. <tr>
  300. <td class="name">
  301. <strong>scene</strong>
  302. </td>
  303. <td class="description last">
  304. <p>The scene or another type of 3D object to precompile.</p>
  305. </td>
  306. </tr>
  307. <tr>
  308. <td class="name">
  309. <strong>camera</strong>
  310. </td>
  311. <td class="description last">
  312. <p>The camera.</p>
  313. </td>
  314. </tr>
  315. <tr>
  316. <td class="name">
  317. <strong>targetScene</strong>
  318. </td>
  319. <td class="description last">
  320. <p>The target scene.</p>
  321. <p>Default is <code>null</code>.</p>
  322. </td>
  323. </tr>
  324. </tbody>
  325. </table>
  326. <dl class="details">
  327. <dt class="tag-returns"><strong>Returns:</strong> The precompiled materials.</dt>
  328. </dl>
  329. </div>
  330. <h3 class="name name-method" id="compileAsync" translate="no">.<a href="#compileAsync">compileAsync</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, targetScene : <span class="param-type"><a href="Scene.html">Scene</a></span> )</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  331. <div class="method">
  332. <div class="description">
  333. <p>Asynchronous version of <a href="WebGLRenderer.html#compile">WebGLRenderer#compile</a>.</p>
  334. <p>This method makes use of the <code>KHR_parallel_shader_compile</code> WebGL extension. Hence,
  335. it is recommended to use this version of <code>compile()</code> whenever possible.</p>
  336. </div>
  337. <table class="params">
  338. <tbody>
  339. <tr>
  340. <td class="name">
  341. <strong>scene</strong>
  342. </td>
  343. <td class="description last">
  344. <p>The scene or another type of 3D object to precompile.</p>
  345. </td>
  346. </tr>
  347. <tr>
  348. <td class="name">
  349. <strong>camera</strong>
  350. </td>
  351. <td class="description last">
  352. <p>The camera.</p>
  353. </td>
  354. </tr>
  355. <tr>
  356. <td class="name">
  357. <strong>targetScene</strong>
  358. </td>
  359. <td class="description last">
  360. <p>The target scene.</p>
  361. <p>Default is <code>null</code>.</p>
  362. </td>
  363. </tr>
  364. </tbody>
  365. </table>
  366. <dl class="details">
  367. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the given scene can be rendered without unnecessary stalling due to shader compilation.</dt>
  368. </dl>
  369. </div>
  370. <h3 class="name name-method" id="copyFramebufferToTexture" translate="no">.<a href="#copyFramebufferToTexture">copyFramebufferToTexture</a><span class="signature">( texture : <span class="param-type"><a href="FramebufferTexture.html">FramebufferTexture</a></span>, position : <span class="param-type"><a href="Vector2.html">Vector2</a></span>, level : <span class="param-type">number</span> )</span> </h3>
  371. <div class="method">
  372. <div class="description">
  373. <p>Copies pixels from the current bound framebuffer into the given texture.</p>
  374. </div>
  375. <table class="params">
  376. <tbody>
  377. <tr>
  378. <td class="name">
  379. <strong>texture</strong>
  380. </td>
  381. <td class="description last">
  382. <p>The texture.</p>
  383. </td>
  384. </tr>
  385. <tr>
  386. <td class="name">
  387. <strong>position</strong>
  388. </td>
  389. <td class="description last">
  390. <p>The start position of the copy operation.</p>
  391. <p>Default is <code>null</code>.</p>
  392. </td>
  393. </tr>
  394. <tr>
  395. <td class="name">
  396. <strong>level</strong>
  397. </td>
  398. <td class="description last">
  399. <p>The mip level. The default represents the base mip.</p>
  400. <p>Default is <code>0</code>.</p>
  401. </td>
  402. </tr>
  403. </tbody>
  404. </table>
  405. </div>
  406. <h3 class="name name-method" id="copyTextureToTexture" translate="no">.<a href="#copyTextureToTexture">copyTextureToTexture</a><span class="signature">( srcTexture : <span class="param-type"><a href="Texture.html">Texture</a></span>, dstTexture : <span class="param-type"><a href="Texture.html">Texture</a></span>, srcRegion : <span class="param-type"><a href="Box2.html">Box2</a> | <a href="Box3.html">Box3</a></span>, dstPosition : <span class="param-type"><a href="Vector2.html">Vector2</a> | <a href="Vector3.html">Vector3</a></span>, srcLevel : <span class="param-type">number</span>, dstLevel : <span class="param-type">number</span> )</span> </h3>
  407. <div class="method">
  408. <div class="description">
  409. <p>Copies data of the given source texture into a destination texture.</p>
  410. <p>When using render target textures as <code>srcTexture</code> and <code>dstTexture</code>, you must make sure both render targets are initialized
  411. <a href="WebGLRenderer.html#initRenderTarget">WebGLRenderer#initRenderTarget</a>.</p>
  412. </div>
  413. <table class="params">
  414. <tbody>
  415. <tr>
  416. <td class="name">
  417. <strong>srcTexture</strong>
  418. </td>
  419. <td class="description last">
  420. <p>The source texture.</p>
  421. </td>
  422. </tr>
  423. <tr>
  424. <td class="name">
  425. <strong>dstTexture</strong>
  426. </td>
  427. <td class="description last">
  428. <p>The destination texture.</p>
  429. </td>
  430. </tr>
  431. <tr>
  432. <td class="name">
  433. <strong>srcRegion</strong>
  434. </td>
  435. <td class="description last">
  436. <p>A bounding box which describes the source region. Can be two or three-dimensional.</p>
  437. <p>Default is <code>null</code>.</p>
  438. </td>
  439. </tr>
  440. <tr>
  441. <td class="name">
  442. <strong>dstPosition</strong>
  443. </td>
  444. <td class="description last">
  445. <p>A vector that represents the origin of the destination region. Can be two or three-dimensional.</p>
  446. <p>Default is <code>null</code>.</p>
  447. </td>
  448. </tr>
  449. <tr>
  450. <td class="name">
  451. <strong>srcLevel</strong>
  452. </td>
  453. <td class="description last">
  454. <p>The source mipmap level to copy.</p>
  455. <p>Default is <code>0</code>.</p>
  456. </td>
  457. </tr>
  458. <tr>
  459. <td class="name">
  460. <strong>dstLevel</strong>
  461. </td>
  462. <td class="description last">
  463. <p>The destination mipmap level.</p>
  464. <p>Default is <code>null</code>.</p>
  465. </td>
  466. </tr>
  467. </tbody>
  468. </table>
  469. </div>
  470. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  471. <div class="method">
  472. <div class="description">
  473. <p>Frees the GPU-related resources allocated by this instance. Call this
  474. method whenever this instance is no longer used in your app.</p>
  475. </div>
  476. </div>
  477. <h3 class="name name-method" id="forceContextLoss" translate="no">.<a href="#forceContextLoss">forceContextLoss</a><span class="signature">()</span> </h3>
  478. <div class="method">
  479. <div class="description">
  480. <p>Simulates a loss of the WebGL context. This requires support for the <code>WEBGL_lose_context</code> extension.</p>
  481. </div>
  482. </div>
  483. <h3 class="name name-method" id="forceContextRestore" translate="no">.<a href="#forceContextRestore">forceContextRestore</a><span class="signature">()</span> </h3>
  484. <div class="method">
  485. <div class="description">
  486. <p>Simulates a restore of the WebGL context. This requires support for the <code>WEBGL_lose_context</code> extension.</p>
  487. </div>
  488. </div>
  489. <h3 class="name name-method" id="getActiveCubeFace" translate="no">.<a href="#getActiveCubeFace">getActiveCubeFace</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  490. <div class="method">
  491. <div class="description">
  492. <p>Returns the active cube face.</p>
  493. </div>
  494. <dl class="details">
  495. <dt class="tag-returns"><strong>Returns:</strong> The active cube face.</dt>
  496. </dl>
  497. </div>
  498. <h3 class="name name-method" id="getActiveMipmapLevel" translate="no">.<a href="#getActiveMipmapLevel">getActiveMipmapLevel</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  499. <div class="method">
  500. <div class="description">
  501. <p>Returns the active mipmap level.</p>
  502. </div>
  503. <dl class="details">
  504. <dt class="tag-returns"><strong>Returns:</strong> The active mipmap level.</dt>
  505. </dl>
  506. </div>
  507. <h3 class="name name-method" id="getClearAlpha" translate="no">.<a href="#getClearAlpha">getClearAlpha</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  508. <div class="method">
  509. <div class="description">
  510. <p>Returns the clear alpha. Ranges within <code>[0,1]</code>.</p>
  511. </div>
  512. <dl class="details">
  513. <dt class="tag-returns"><strong>Returns:</strong> The clear alpha.</dt>
  514. </dl>
  515. </div>
  516. <h3 class="name name-method" id="getClearColor" translate="no">.<a href="#getClearColor">getClearColor</a><span class="signature">( target : <span class="param-type"><a href="Color.html">Color</a></span> )</span><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
  517. <div class="method">
  518. <div class="description">
  519. <p>Returns the clear color.</p>
  520. </div>
  521. <table class="params">
  522. <tbody>
  523. <tr>
  524. <td class="name">
  525. <strong>target</strong>
  526. </td>
  527. <td class="description last">
  528. <p>The method writes the result in this target object.</p>
  529. </td>
  530. </tr>
  531. </tbody>
  532. </table>
  533. <dl class="details">
  534. <dt class="tag-returns"><strong>Returns:</strong> The clear color.</dt>
  535. </dl>
  536. </div>
  537. <h3 class="name name-method" id="getContext" translate="no">.<a href="#getContext">getContext</a><span class="signature">()</span><span class="type-signature"> : WebGL2RenderingContext</span> </h3>
  538. <div class="method">
  539. <div class="description">
  540. <p>Returns the rendering context.</p>
  541. </div>
  542. <dl class="details">
  543. <dt class="tag-returns"><strong>Returns:</strong> The rendering context.</dt>
  544. </dl>
  545. </div>
  546. <h3 class="name name-method" id="getContextAttributes" translate="no">.<a href="#getContextAttributes">getContextAttributes</a><span class="signature">()</span><span class="type-signature"> : WebGLContextAttributes</span> </h3>
  547. <div class="method">
  548. <div class="description">
  549. <p>Returns the rendering context attributes.</p>
  550. </div>
  551. <dl class="details">
  552. <dt class="tag-returns"><strong>Returns:</strong> The rendering context attributes.</dt>
  553. </dl>
  554. </div>
  555. <h3 class="name name-method" id="getCurrentViewport" translate="no">.<a href="#getCurrentViewport">getCurrentViewport</a><span class="signature">( target : <span class="param-type"><a href="Vector2.html">Vector2</a></span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  556. <div class="method">
  557. <div class="description">
  558. <p>Returns the current viewport definition.</p>
  559. </div>
  560. <table class="params">
  561. <tbody>
  562. <tr>
  563. <td class="name">
  564. <strong>target</strong>
  565. </td>
  566. <td class="description last">
  567. <p>The method writes the result in this target object.</p>
  568. </td>
  569. </tr>
  570. </tbody>
  571. </table>
  572. <dl class="details">
  573. <dt class="tag-returns"><strong>Returns:</strong> The current viewport definition.</dt>
  574. </dl>
  575. </div>
  576. <h3 class="name name-method" id="getDrawingBufferSize" translate="no">.<a href="#getDrawingBufferSize">getDrawingBufferSize</a><span class="signature">( target : <span class="param-type"><a href="Vector2.html">Vector2</a></span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  577. <div class="method">
  578. <div class="description">
  579. <p>Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.</p>
  580. </div>
  581. <table class="params">
  582. <tbody>
  583. <tr>
  584. <td class="name">
  585. <strong>target</strong>
  586. </td>
  587. <td class="description last">
  588. <p>The method writes the result in this target object.</p>
  589. </td>
  590. </tr>
  591. </tbody>
  592. </table>
  593. <dl class="details">
  594. <dt class="tag-returns"><strong>Returns:</strong> The drawing buffer size.</dt>
  595. </dl>
  596. </div>
  597. <h3 class="name name-method" id="getPixelRatio" translate="no">.<a href="#getPixelRatio">getPixelRatio</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  598. <div class="method">
  599. <div class="description">
  600. <p>Returns the pixel ratio.</p>
  601. </div>
  602. <dl class="details">
  603. <dt class="tag-returns"><strong>Returns:</strong> The pixel ratio.</dt>
  604. </dl>
  605. </div>
  606. <h3 class="name name-method" id="getRenderTarget" translate="no">.<a href="#getRenderTarget">getRenderTarget</a><span class="signature">()</span><span class="type-signature"> : <a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> </h3>
  607. <div class="method">
  608. <div class="description">
  609. <p>Returns the active render target.</p>
  610. </div>
  611. <dl class="details">
  612. <dt class="tag-returns"><strong>Returns:</strong> The active render target. Returns <code>null</code> if no render target
  613. is currently set.</dt>
  614. </dl>
  615. </div>
  616. <h3 class="name name-method" id="getScissor" translate="no">.<a href="#getScissor">getScissor</a><span class="signature">( target : <span class="param-type"><a href="Vector4.html">Vector4</a></span> )</span><span class="type-signature"> : <a href="Vector4.html">Vector4</a></span> </h3>
  617. <div class="method">
  618. <div class="description">
  619. <p>Returns the scissor region.</p>
  620. </div>
  621. <table class="params">
  622. <tbody>
  623. <tr>
  624. <td class="name">
  625. <strong>target</strong>
  626. </td>
  627. <td class="description last">
  628. <p>The method writes the result in this target object.</p>
  629. </td>
  630. </tr>
  631. </tbody>
  632. </table>
  633. <dl class="details">
  634. <dt class="tag-returns"><strong>Returns:</strong> The scissor region.</dt>
  635. </dl>
  636. </div>
  637. <h3 class="name name-method" id="getScissorTest" translate="no">.<a href="#getScissorTest">getScissorTest</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  638. <div class="method">
  639. <div class="description">
  640. <p>Returns <code>true</code> if the scissor test is enabled.</p>
  641. </div>
  642. <dl class="details">
  643. <dt class="tag-returns"><strong>Returns:</strong> Whether the scissor test is enabled or not.</dt>
  644. </dl>
  645. </div>
  646. <h3 class="name name-method" id="getSize" translate="no">.<a href="#getSize">getSize</a><span class="signature">( target : <span class="param-type"><a href="Vector2.html">Vector2</a></span> )</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  647. <div class="method">
  648. <div class="description">
  649. <p>Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.</p>
  650. </div>
  651. <table class="params">
  652. <tbody>
  653. <tr>
  654. <td class="name">
  655. <strong>target</strong>
  656. </td>
  657. <td class="description last">
  658. <p>The method writes the result in this target object.</p>
  659. </td>
  660. </tr>
  661. </tbody>
  662. </table>
  663. <dl class="details">
  664. <dt class="tag-returns"><strong>Returns:</strong> The renderer's size in logical pixels.</dt>
  665. </dl>
  666. </div>
  667. <h3 class="name name-method" id="getViewport" translate="no">.<a href="#getViewport">getViewport</a><span class="signature">( target : <span class="param-type"><a href="Vector4.html">Vector4</a></span> )</span><span class="type-signature"> : <a href="Vector4.html">Vector4</a></span> </h3>
  668. <div class="method">
  669. <div class="description">
  670. <p>Returns the viewport definition.</p>
  671. </div>
  672. <table class="params">
  673. <tbody>
  674. <tr>
  675. <td class="name">
  676. <strong>target</strong>
  677. </td>
  678. <td class="description last">
  679. <p>The method writes the result in this target object.</p>
  680. </td>
  681. </tr>
  682. </tbody>
  683. </table>
  684. <dl class="details">
  685. <dt class="tag-returns"><strong>Returns:</strong> The viewport definition.</dt>
  686. </dl>
  687. </div>
  688. <h3 class="name name-method" id="initRenderTarget" translate="no">.<a href="#initRenderTarget">initRenderTarget</a><span class="signature">( target : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span> )</span> </h3>
  689. <div class="method">
  690. <div class="description">
  691. <p>Initializes the given WebGLRenderTarget memory. Useful for initializing a render target so data
  692. can be copied into it using <a href="WebGLRenderer.html#copyTextureToTexture">WebGLRenderer#copyTextureToTexture</a> before it has been
  693. rendered to.</p>
  694. </div>
  695. <table class="params">
  696. <tbody>
  697. <tr>
  698. <td class="name">
  699. <strong>target</strong>
  700. </td>
  701. <td class="description last">
  702. <p>The render target.</p>
  703. </td>
  704. </tr>
  705. </tbody>
  706. </table>
  707. </div>
  708. <h3 class="name name-method" id="initTexture" translate="no">.<a href="#initTexture">initTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span> </h3>
  709. <div class="method">
  710. <div class="description">
  711. <p>Initializes the given texture. Useful for preloading a texture rather than waiting until first
  712. render (which can cause noticeable lags due to decode and GPU upload overhead).</p>
  713. </div>
  714. <table class="params">
  715. <tbody>
  716. <tr>
  717. <td class="name">
  718. <strong>texture</strong>
  719. </td>
  720. <td class="description last">
  721. <p>The texture.</p>
  722. </td>
  723. </tr>
  724. </tbody>
  725. </table>
  726. </div>
  727. <h3 class="name name-method" id="readRenderTargetPixels" translate="no">.<a href="#readRenderTargetPixels">readRenderTargetPixels</a><span class="signature">( renderTarget : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, buffer : <span class="param-type">TypedArray</span>, activeCubeFaceIndex : <span class="param-type">number</span>, textureIndex : <span class="param-type">number</span> )</span> </h3>
  728. <div class="method">
  729. <div class="description">
  730. <p>Reads the pixel data from the given render target into the given buffer.</p>
  731. </div>
  732. <table class="params">
  733. <tbody>
  734. <tr>
  735. <td class="name">
  736. <strong>renderTarget</strong>
  737. </td>
  738. <td class="description last">
  739. <p>The render target to read from.</p>
  740. </td>
  741. </tr>
  742. <tr>
  743. <td class="name">
  744. <strong>x</strong>
  745. </td>
  746. <td class="description last">
  747. <p>The <code>x</code> coordinate of the copy region's origin.</p>
  748. </td>
  749. </tr>
  750. <tr>
  751. <td class="name">
  752. <strong>y</strong>
  753. </td>
  754. <td class="description last">
  755. <p>The <code>y</code> coordinate of the copy region's origin.</p>
  756. </td>
  757. </tr>
  758. <tr>
  759. <td class="name">
  760. <strong>width</strong>
  761. </td>
  762. <td class="description last">
  763. <p>The width of the copy region.</p>
  764. </td>
  765. </tr>
  766. <tr>
  767. <td class="name">
  768. <strong>height</strong>
  769. </td>
  770. <td class="description last">
  771. <p>The height of the copy region.</p>
  772. </td>
  773. </tr>
  774. <tr>
  775. <td class="name">
  776. <strong>buffer</strong>
  777. </td>
  778. <td class="description last">
  779. <p>The result buffer.</p>
  780. </td>
  781. </tr>
  782. <tr>
  783. <td class="name">
  784. <strong>activeCubeFaceIndex</strong>
  785. </td>
  786. <td class="description last">
  787. <p>The active cube face index.</p>
  788. </td>
  789. </tr>
  790. <tr>
  791. <td class="name">
  792. <strong>textureIndex</strong>
  793. </td>
  794. <td class="description last">
  795. <p>The texture index of an MRT render target.</p>
  796. <p>Default is <code>0</code>.</p>
  797. </td>
  798. </tr>
  799. </tbody>
  800. </table>
  801. </div>
  802. <h3 class="name name-method" id="readRenderTargetPixelsAsync" translate="no">.<a href="#readRenderTargetPixelsAsync">readRenderTargetPixelsAsync</a><span class="signature">( renderTarget : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, x : <span class="param-type">number</span>, y : <span class="param-type">number</span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, buffer : <span class="param-type">TypedArray</span>, activeCubeFaceIndex : <span class="param-type">number</span>, textureIndex : <span class="param-type">number</span> )</span><span class="type-signature"> : Promise.&lt;TypedArray></span> <span class="type-signature">(async) </span></h3>
  803. <div class="method">
  804. <div class="description">
  805. <p>Asynchronous, non-blocking version of <a href="WebGLRenderer.html#readRenderTargetPixels">WebGLRenderer#readRenderTargetPixels</a>.</p>
  806. <p>It is recommended to use this version of <code>readRenderTargetPixels()</code> whenever possible.</p>
  807. </div>
  808. <table class="params">
  809. <tbody>
  810. <tr>
  811. <td class="name">
  812. <strong>renderTarget</strong>
  813. </td>
  814. <td class="description last">
  815. <p>The render target to read from.</p>
  816. </td>
  817. </tr>
  818. <tr>
  819. <td class="name">
  820. <strong>x</strong>
  821. </td>
  822. <td class="description last">
  823. <p>The <code>x</code> coordinate of the copy region's origin.</p>
  824. </td>
  825. </tr>
  826. <tr>
  827. <td class="name">
  828. <strong>y</strong>
  829. </td>
  830. <td class="description last">
  831. <p>The <code>y</code> coordinate of the copy region's origin.</p>
  832. </td>
  833. </tr>
  834. <tr>
  835. <td class="name">
  836. <strong>width</strong>
  837. </td>
  838. <td class="description last">
  839. <p>The width of the copy region.</p>
  840. </td>
  841. </tr>
  842. <tr>
  843. <td class="name">
  844. <strong>height</strong>
  845. </td>
  846. <td class="description last">
  847. <p>The height of the copy region.</p>
  848. </td>
  849. </tr>
  850. <tr>
  851. <td class="name">
  852. <strong>buffer</strong>
  853. </td>
  854. <td class="description last">
  855. <p>The result buffer.</p>
  856. </td>
  857. </tr>
  858. <tr>
  859. <td class="name">
  860. <strong>activeCubeFaceIndex</strong>
  861. </td>
  862. <td class="description last">
  863. <p>The active cube face index.</p>
  864. </td>
  865. </tr>
  866. <tr>
  867. <td class="name">
  868. <strong>textureIndex</strong>
  869. </td>
  870. <td class="description last">
  871. <p>The texture index of an MRT render target.</p>
  872. <p>Default is <code>0</code>.</p>
  873. </td>
  874. </tr>
  875. </tbody>
  876. </table>
  877. <dl class="details">
  878. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the read has been finished. The resolve provides the read data as a typed array.</dt>
  879. </dl>
  880. </div>
  881. <h3 class="name name-method" id="render" translate="no">.<a href="#render">render</a><span class="signature">( scene : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span> )</span> </h3>
  882. <div class="method">
  883. <div class="description">
  884. <p>Renders the given scene (or other type of 3D object) using the given camera.</p>
  885. <p>The render is done to a previously specified render target set by calling <a href="WebGLRenderer.html#setRenderTarget">WebGLRenderer#setRenderTarget</a>
  886. or to the canvas as usual.</p>
  887. <p>By default render buffers are cleared before rendering but you can prevent
  888. this by setting the property <code>autoClear</code> to <code>false</code>. If you want to prevent
  889. only certain buffers being cleared you can <code>autoClearColor</code>, <code>autoClearDepth</code>
  890. or <code>autoClearStencil</code> to <code>false</code>. To force a clear, use <a href="WebGLRenderer.html#clear">WebGLRenderer#clear</a>.</p>
  891. </div>
  892. <table class="params">
  893. <tbody>
  894. <tr>
  895. <td class="name">
  896. <strong>scene</strong>
  897. </td>
  898. <td class="description last">
  899. <p>The scene to render.</p>
  900. </td>
  901. </tr>
  902. <tr>
  903. <td class="name">
  904. <strong>camera</strong>
  905. </td>
  906. <td class="description last">
  907. <p>The camera.</p>
  908. </td>
  909. </tr>
  910. </tbody>
  911. </table>
  912. </div>
  913. <h3 class="name name-method" id="resetState" translate="no">.<a href="#resetState">resetState</a><span class="signature">()</span> </h3>
  914. <div class="method">
  915. <div class="description">
  916. <p>Can be used to reset the internal WebGL state. This method is mostly
  917. relevant for applications which share a single WebGL context across
  918. multiple WebGL libraries.</p>
  919. </div>
  920. </div>
  921. <h3 class="name name-method" id="setAnimationLoop" translate="no">.<a href="#setAnimationLoop">setAnimationLoop</a><span class="signature">( callback : <span class="param-type"><a href="global.html#onAnimationCallback">onAnimationCallback</a></span> )</span> </h3>
  922. <div class="method">
  923. <div class="description">
  924. <p>Applications are advised to always define the animation loop
  925. with this method and not manually with <code>requestAnimationFrame()</code>
  926. for best compatibility.</p>
  927. </div>
  928. <table class="params">
  929. <tbody>
  930. <tr>
  931. <td class="name">
  932. <strong>callback</strong>
  933. </td>
  934. <td class="description last">
  935. <p>The application's animation loop.</p>
  936. </td>
  937. </tr>
  938. </tbody>
  939. </table>
  940. </div>
  941. <h3 class="name name-method" id="setClearAlpha" translate="no">.<a href="#setClearAlpha">setClearAlpha</a><span class="signature">( alpha : <span class="param-type">number</span> )</span> </h3>
  942. <div class="method">
  943. <div class="description">
  944. <p>Sets the clear alpha.</p>
  945. </div>
  946. <table class="params">
  947. <tbody>
  948. <tr>
  949. <td class="name">
  950. <strong>alpha</strong>
  951. </td>
  952. <td class="description last">
  953. <p>The clear alpha.</p>
  954. </td>
  955. </tr>
  956. </tbody>
  957. </table>
  958. </div>
  959. <h3 class="name name-method" id="setClearColor" translate="no">.<a href="#setClearColor">setClearColor</a><span class="signature">( color : <span class="param-type"><a href="Color.html">Color</a></span>, alpha : <span class="param-type">number</span> )</span> </h3>
  960. <div class="method">
  961. <div class="description">
  962. <p>Sets the clear color and alpha.</p>
  963. </div>
  964. <table class="params">
  965. <tbody>
  966. <tr>
  967. <td class="name">
  968. <strong>color</strong>
  969. </td>
  970. <td class="description last">
  971. <p>The clear color.</p>
  972. </td>
  973. </tr>
  974. <tr>
  975. <td class="name">
  976. <strong>alpha</strong>
  977. </td>
  978. <td class="description last">
  979. <p>The clear alpha.</p>
  980. <p>Default is <code>1</code>.</p>
  981. </td>
  982. </tr>
  983. </tbody>
  984. </table>
  985. </div>
  986. <h3 class="name name-method" id="setDrawingBufferSize" translate="no">.<a href="#setDrawingBufferSize">setDrawingBufferSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, pixelRatio : <span class="param-type">number</span> )</span> </h3>
  987. <div class="method">
  988. <div class="description">
  989. <p>This method allows to define the drawing buffer size by specifying
  990. width, height and pixel ratio all at once. The size of the drawing
  991. buffer is computed with this formula:</p>
  992. <pre><code class="language-js">size.x = width * pixelRatio;
  993. size.y = height * pixelRatio;
  994. </code></pre>
  995. </div>
  996. <table class="params">
  997. <tbody>
  998. <tr>
  999. <td class="name">
  1000. <strong>width</strong>
  1001. </td>
  1002. <td class="description last">
  1003. <p>The width in logical pixels.</p>
  1004. </td>
  1005. </tr>
  1006. <tr>
  1007. <td class="name">
  1008. <strong>height</strong>
  1009. </td>
  1010. <td class="description last">
  1011. <p>The height in logical pixels.</p>
  1012. </td>
  1013. </tr>
  1014. <tr>
  1015. <td class="name">
  1016. <strong>pixelRatio</strong>
  1017. </td>
  1018. <td class="description last">
  1019. <p>The pixel ratio.</p>
  1020. </td>
  1021. </tr>
  1022. </tbody>
  1023. </table>
  1024. </div>
  1025. <h3 class="name name-method" id="setOpaqueSort" translate="no">.<a href="#setOpaqueSort">setOpaqueSort</a><span class="signature">( method : <span class="param-type">function</span> )</span> </h3>
  1026. <div class="method">
  1027. <div class="description">
  1028. <p>Sets a custom opaque sort function for the render lists. Pass <code>null</code>
  1029. to use the default <code>painterSortStable</code> function.</p>
  1030. </div>
  1031. <table class="params">
  1032. <tbody>
  1033. <tr>
  1034. <td class="name">
  1035. <strong>method</strong>
  1036. </td>
  1037. <td class="description last">
  1038. <p>The opaque sort function.</p>
  1039. </td>
  1040. </tr>
  1041. </tbody>
  1042. </table>
  1043. </div>
  1044. <h3 class="name name-method" id="setPixelRatio" translate="no">.<a href="#setPixelRatio">setPixelRatio</a><span class="signature">( value : <span class="param-type">number</span> )</span> </h3>
  1045. <div class="method">
  1046. <div class="description">
  1047. <p>Sets the given pixel ratio and resizes the canvas if necessary.</p>
  1048. </div>
  1049. <table class="params">
  1050. <tbody>
  1051. <tr>
  1052. <td class="name">
  1053. <strong>value</strong>
  1054. </td>
  1055. <td class="description last">
  1056. <p>The pixel ratio.</p>
  1057. </td>
  1058. </tr>
  1059. </tbody>
  1060. </table>
  1061. </div>
  1062. <h3 class="name name-method" id="setRenderTarget" translate="no">.<a href="#setRenderTarget">setRenderTarget</a><span class="signature">( renderTarget : <span class="param-type"><a href="WebGLRenderTarget.html">WebGLRenderTarget</a></span>, activeCubeFace : <span class="param-type">number</span>, activeMipmapLevel : <span class="param-type">number</span> )</span> </h3>
  1063. <div class="method">
  1064. <div class="description">
  1065. <p>Sets the active rendertarget.</p>
  1066. </div>
  1067. <table class="params">
  1068. <tbody>
  1069. <tr>
  1070. <td class="name">
  1071. <strong>renderTarget</strong>
  1072. </td>
  1073. <td class="description last">
  1074. <p>The render target to set. When <code>null</code> is given,
  1075. the canvas is set as the active render target instead.</p>
  1076. </td>
  1077. </tr>
  1078. <tr>
  1079. <td class="name">
  1080. <strong>activeCubeFace</strong>
  1081. </td>
  1082. <td class="description last">
  1083. <p>The active cube face when using a cube render target.
  1084. Indicates the z layer to render in to when using 3D or array render targets.</p>
  1085. <p>Default is <code>0</code>.</p>
  1086. </td>
  1087. </tr>
  1088. <tr>
  1089. <td class="name">
  1090. <strong>activeMipmapLevel</strong>
  1091. </td>
  1092. <td class="description last">
  1093. <p>The active mipmap level.</p>
  1094. <p>Default is <code>0</code>.</p>
  1095. </td>
  1096. </tr>
  1097. </tbody>
  1098. </table>
  1099. </div>
  1100. <h3 class="name name-method" id="setScissor" translate="no">.<a href="#setScissor">setScissor</a><span class="signature">( x : <span class="param-type">number | <a href="Vector4.html">Vector4</a></span>, y : <span class="param-type">number</span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  1101. <div class="method">
  1102. <div class="description">
  1103. <p>Sets the scissor region to render from <code>(x, y)</code> to <code>(x + width, y + height)</code>.</p>
  1104. </div>
  1105. <table class="params">
  1106. <tbody>
  1107. <tr>
  1108. <td class="name">
  1109. <strong>x</strong>
  1110. </td>
  1111. <td class="description last">
  1112. <p>The horizontal coordinate for the lower left corner of the scissor region origin in logical pixel unit.
  1113. Or alternatively a four-component vector specifying all the parameters of the scissor region.</p>
  1114. </td>
  1115. </tr>
  1116. <tr>
  1117. <td class="name">
  1118. <strong>y</strong>
  1119. </td>
  1120. <td class="description last">
  1121. <p>The vertical coordinate for the lower left corner of the scissor region origin in logical pixel unit.</p>
  1122. </td>
  1123. </tr>
  1124. <tr>
  1125. <td class="name">
  1126. <strong>width</strong>
  1127. </td>
  1128. <td class="description last">
  1129. <p>The width of the scissor region in logical pixel unit.</p>
  1130. </td>
  1131. </tr>
  1132. <tr>
  1133. <td class="name">
  1134. <strong>height</strong>
  1135. </td>
  1136. <td class="description last">
  1137. <p>The height of the scissor region in logical pixel unit.</p>
  1138. </td>
  1139. </tr>
  1140. </tbody>
  1141. </table>
  1142. </div>
  1143. <h3 class="name name-method" id="setScissorTest" translate="no">.<a href="#setScissorTest">setScissorTest</a><span class="signature">( boolean : <span class="param-type">boolean</span> )</span> </h3>
  1144. <div class="method">
  1145. <div class="description">
  1146. <p>Enable or disable the scissor test. When this is enabled, only the pixels
  1147. within the defined scissor area will be affected by further renderer
  1148. actions.</p>
  1149. </div>
  1150. <table class="params">
  1151. <tbody>
  1152. <tr>
  1153. <td class="name">
  1154. <strong>boolean</strong>
  1155. </td>
  1156. <td class="description last">
  1157. <p>Whether the scissor test is enabled or not.</p>
  1158. </td>
  1159. </tr>
  1160. </tbody>
  1161. </table>
  1162. </div>
  1163. <h3 class="name name-method" id="setSize" translate="no">.<a href="#setSize">setSize</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, updateStyle : <span class="param-type">boolean</span> )</span> </h3>
  1164. <div class="method">
  1165. <div class="description">
  1166. <p>Resizes the output canvas to (width, height) with device pixel ratio taken
  1167. into account, and also sets the viewport to fit that size, starting in (0,
  1168. 0). Setting <code>updateStyle</code> to false prevents any style changes to the output canvas.</p>
  1169. </div>
  1170. <table class="params">
  1171. <tbody>
  1172. <tr>
  1173. <td class="name">
  1174. <strong>width</strong>
  1175. </td>
  1176. <td class="description last">
  1177. <p>The width in logical pixels.</p>
  1178. </td>
  1179. </tr>
  1180. <tr>
  1181. <td class="name">
  1182. <strong>height</strong>
  1183. </td>
  1184. <td class="description last">
  1185. <p>The height in logical pixels.</p>
  1186. </td>
  1187. </tr>
  1188. <tr>
  1189. <td class="name">
  1190. <strong>updateStyle</strong>
  1191. </td>
  1192. <td class="description last">
  1193. <p>Whether to update the <code>style</code> attribute of the canvas or not.</p>
  1194. <p>Default is <code>true</code>.</p>
  1195. </td>
  1196. </tr>
  1197. </tbody>
  1198. </table>
  1199. </div>
  1200. <h3 class="name name-method" id="setTransparentSort" translate="no">.<a href="#setTransparentSort">setTransparentSort</a><span class="signature">( method : <span class="param-type">function</span> )</span> </h3>
  1201. <div class="method">
  1202. <div class="description">
  1203. <p>Sets a custom transparent sort function for the render lists. Pass <code>null</code>
  1204. to use the default <code>reversePainterSortStable</code> function.</p>
  1205. </div>
  1206. <table class="params">
  1207. <tbody>
  1208. <tr>
  1209. <td class="name">
  1210. <strong>method</strong>
  1211. </td>
  1212. <td class="description last">
  1213. <p>The opaque sort function.</p>
  1214. </td>
  1215. </tr>
  1216. </tbody>
  1217. </table>
  1218. </div>
  1219. <h3 class="name name-method" id="setViewport" translate="no">.<a href="#setViewport">setViewport</a><span class="signature">( x : <span class="param-type">number | <a href="Vector4.html">Vector4</a></span>, y : <span class="param-type">number</span>, width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  1220. <div class="method">
  1221. <div class="description">
  1222. <p>Sets the viewport to render from <code>(x, y)</code> to <code>(x + width, y + height)</code>.</p>
  1223. </div>
  1224. <table class="params">
  1225. <tbody>
  1226. <tr>
  1227. <td class="name">
  1228. <strong>x</strong>
  1229. </td>
  1230. <td class="description last">
  1231. <p>The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.
  1232. Or alternatively a four-component vector specifying all the parameters of the viewport.</p>
  1233. </td>
  1234. </tr>
  1235. <tr>
  1236. <td class="name">
  1237. <strong>y</strong>
  1238. </td>
  1239. <td class="description last">
  1240. <p>The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.</p>
  1241. </td>
  1242. </tr>
  1243. <tr>
  1244. <td class="name">
  1245. <strong>width</strong>
  1246. </td>
  1247. <td class="description last">
  1248. <p>The width of the viewport in logical pixel unit.</p>
  1249. </td>
  1250. </tr>
  1251. <tr>
  1252. <td class="name">
  1253. <strong>height</strong>
  1254. </td>
  1255. <td class="description last">
  1256. <p>The height of the viewport in logical pixel unit.</p>
  1257. </td>
  1258. </tr>
  1259. </tbody>
  1260. </table>
  1261. </div>
  1262. <h2 class="subsection-title">Type Definitions</h2>
  1263. <div class="member">
  1264. <h3 class="name" id="~Capabilities" translate="no">.<a href="#~Capabilities">Capabilities</a> </h3>
  1265. <div class="description">
  1266. <p>WebGLRenderer Capabilities.</p>
  1267. </div>
  1268. <table class="props">
  1269. <tbody>
  1270. <tr>
  1271. <td class="name">
  1272. <strong>getMaxAnisotropy</strong>
  1273. <br>
  1274. <span class="param-type">function</span>
  1275. </td>
  1276. <td class="description last">
  1277. <p>Returns the maximum available anisotropy.</p>
  1278. </td>
  1279. </tr>
  1280. <tr>
  1281. <td class="name">
  1282. <strong>getMaxPrecision</strong>
  1283. <br>
  1284. <span class="param-type">function</span>
  1285. </td>
  1286. <td class="description last">
  1287. <p>Returns the maximum available precision for vertex and fragment shaders.</p>
  1288. </td>
  1289. </tr>
  1290. <tr>
  1291. <td class="name">
  1292. <strong>logarithmicDepthBuffer</strong>
  1293. <br>
  1294. <span class="param-type">boolean</span>
  1295. </td>
  1296. <td class="description last">
  1297. <p><code>true</code> if <code>logarithmicDepthBuffer</code> was set to <code>true</code> in the constructor.</p>
  1298. </td>
  1299. </tr>
  1300. <tr>
  1301. <td class="name">
  1302. <strong>maxAttributes</strong>
  1303. <br>
  1304. <span class="param-type">number</span>
  1305. </td>
  1306. <td class="description last">
  1307. <p>The number of shader attributes that can be used by the vertex shader.</p>
  1308. </td>
  1309. </tr>
  1310. <tr>
  1311. <td class="name">
  1312. <strong>maxCubemapSize</strong>
  1313. <br>
  1314. <span class="param-type">number</span>
  1315. </td>
  1316. <td class="description last">
  1317. <p>Maximum height * width of cube map textures that a shader can use.</p>
  1318. </td>
  1319. </tr>
  1320. <tr>
  1321. <td class="name">
  1322. <strong>maxFragmentUniforms</strong>
  1323. <br>
  1324. <span class="param-type">number</span>
  1325. </td>
  1326. <td class="description last">
  1327. <p>The number of uniforms that can be used by a fragment shader.</p>
  1328. </td>
  1329. </tr>
  1330. <tr>
  1331. <td class="name">
  1332. <strong>maxSamples</strong>
  1333. <br>
  1334. <span class="param-type">number</span>
  1335. </td>
  1336. <td class="description last">
  1337. <p>Maximum number of samples in context of Multisample anti-aliasing (MSAA).</p>
  1338. </td>
  1339. </tr>
  1340. <tr>
  1341. <td class="name">
  1342. <strong>maxTextures</strong>
  1343. <br>
  1344. <span class="param-type">number</span>
  1345. </td>
  1346. <td class="description last">
  1347. <p>The maximum number of textures that can be used by a shader.</p>
  1348. </td>
  1349. </tr>
  1350. <tr>
  1351. <td class="name">
  1352. <strong>maxTextureSize</strong>
  1353. <br>
  1354. <span class="param-type">number</span>
  1355. </td>
  1356. <td class="description last">
  1357. <p>Maximum height * width of a texture that a shader use.</p>
  1358. </td>
  1359. </tr>
  1360. <tr>
  1361. <td class="name">
  1362. <strong>maxVaryings</strong>
  1363. <br>
  1364. <span class="param-type">number</span>
  1365. </td>
  1366. <td class="description last">
  1367. <p>The number of varying vectors that can used by shaders.</p>
  1368. </td>
  1369. </tr>
  1370. <tr>
  1371. <td class="name">
  1372. <strong>maxVertexTextures</strong>
  1373. <br>
  1374. <span class="param-type">number</span>
  1375. </td>
  1376. <td class="description last">
  1377. <p>The number of textures that can be used in a vertex shader.</p>
  1378. </td>
  1379. </tr>
  1380. <tr>
  1381. <td class="name">
  1382. <strong>maxVertexUniforms</strong>
  1383. <br>
  1384. <span class="param-type">number</span>
  1385. </td>
  1386. <td class="description last">
  1387. <p>The maximum number of uniforms that can be used in a vertex shader.</p>
  1388. </td>
  1389. </tr>
  1390. <tr>
  1391. <td class="name">
  1392. <strong>precision</strong>
  1393. <br>
  1394. <span class="param-type">string</span>
  1395. </td>
  1396. <td class="description last">
  1397. <p>The shader precision currently being used by the renderer.</p>
  1398. </td>
  1399. </tr>
  1400. <tr>
  1401. <td class="name">
  1402. <strong>reversedDepthBuffer</strong>
  1403. <br>
  1404. <span class="param-type">boolean</span>
  1405. </td>
  1406. <td class="description last">
  1407. <p><code>true</code> if <code>reversedDepthBuffer</code> was set to <code>true</code> in the constructor
  1408. and the rendering context supports <code>EXT_clip_control</code>.</p>
  1409. </td>
  1410. </tr>
  1411. <tr>
  1412. <td class="name">
  1413. <strong>vertexTextures</strong>
  1414. <br>
  1415. <span class="param-type">boolean</span>
  1416. </td>
  1417. <td class="description last">
  1418. <p><code>true</code> if vertex textures can be used.</p>
  1419. </td>
  1420. </tr>
  1421. </tbody>
  1422. </table>
  1423. </div>
  1424. <div class="member">
  1425. <h3 class="name" id="~Info" translate="no">.<a href="#~Info">Info</a> </h3>
  1426. <div class="description">
  1427. <p>WebGLRenderer Info</p>
  1428. </div>
  1429. <table class="props">
  1430. <tbody>
  1431. <tr>
  1432. <td class="name">
  1433. <strong>autoReset</strong>
  1434. <br>
  1435. <span class="param-type">boolean</span>
  1436. </td>
  1437. <td class="description last">
  1438. <p>Whether to automatically reset the info by the renderer or not.</p>
  1439. <p>Default is <code>true</code>.</p>
  1440. </td>
  1441. </tr>
  1442. <tr>
  1443. <td class="name">
  1444. <strong>memory</strong>
  1445. <br>
  1446. <span class="param-type"><a href="WebGLRenderer.html#~InfoMemory">WebGLRenderer~InfoMemory</a></span>
  1447. </td>
  1448. <td class="description last">
  1449. <p>Information about allocated objects.</p>
  1450. </td>
  1451. </tr>
  1452. <tr>
  1453. <td class="name">
  1454. <strong>render</strong>
  1455. <br>
  1456. <span class="param-type"><a href="WebGLRenderer.html#~InfoRender">WebGLRenderer~InfoRender</a></span>
  1457. </td>
  1458. <td class="description last">
  1459. <p>Information about rendered objects.</p>
  1460. </td>
  1461. </tr>
  1462. <tr>
  1463. <td class="name">
  1464. <strong>programs</strong>
  1465. <br>
  1466. <span class="param-type">Array.&lt;WebGLProgram></span>
  1467. </td>
  1468. <td class="description last">
  1469. <p>An array <code>WebGLProgram</code>s used for rendering.</p>
  1470. </td>
  1471. </tr>
  1472. <tr>
  1473. <td class="name">
  1474. <strong>reset</strong>
  1475. <br>
  1476. <span class="param-type">function</span>
  1477. </td>
  1478. <td class="description last">
  1479. <p>Resets the info object for the next frame.</p>
  1480. </td>
  1481. </tr>
  1482. </tbody>
  1483. </table>
  1484. </div>
  1485. <div class="member">
  1486. <h3 class="name" id="~InfoMemory" translate="no">.<a href="#~InfoMemory">InfoMemory</a> </h3>
  1487. <div class="description">
  1488. <p>WebGLRenderer Info Memory</p>
  1489. </div>
  1490. <table class="props">
  1491. <tbody>
  1492. <tr>
  1493. <td class="name">
  1494. <strong>geometries</strong>
  1495. <br>
  1496. <span class="param-type">number</span>
  1497. </td>
  1498. <td class="description last">
  1499. <p>The number of active geometries.</p>
  1500. </td>
  1501. </tr>
  1502. <tr>
  1503. <td class="name">
  1504. <strong>textures</strong>
  1505. <br>
  1506. <span class="param-type">number</span>
  1507. </td>
  1508. <td class="description last">
  1509. <p>The number of active textures.</p>
  1510. </td>
  1511. </tr>
  1512. </tbody>
  1513. </table>
  1514. </div>
  1515. <div class="member">
  1516. <h3 class="name" id="~InfoRender" translate="no">.<a href="#~InfoRender">InfoRender</a> </h3>
  1517. <div class="description">
  1518. <p>WebGLRenderer Info Render</p>
  1519. </div>
  1520. <table class="props">
  1521. <tbody>
  1522. <tr>
  1523. <td class="name">
  1524. <strong>frame</strong>
  1525. <br>
  1526. <span class="param-type">number</span>
  1527. </td>
  1528. <td class="description last">
  1529. <p>The frame ID.</p>
  1530. </td>
  1531. </tr>
  1532. <tr>
  1533. <td class="name">
  1534. <strong>calls</strong>
  1535. <br>
  1536. <span class="param-type">number</span>
  1537. </td>
  1538. <td class="description last">
  1539. <p>The number of draw calls per frame.</p>
  1540. </td>
  1541. </tr>
  1542. <tr>
  1543. <td class="name">
  1544. <strong>triangles</strong>
  1545. <br>
  1546. <span class="param-type">number</span>
  1547. </td>
  1548. <td class="description last">
  1549. <p>The number of rendered triangles primitives per frame.</p>
  1550. </td>
  1551. </tr>
  1552. <tr>
  1553. <td class="name">
  1554. <strong>points</strong>
  1555. <br>
  1556. <span class="param-type">number</span>
  1557. </td>
  1558. <td class="description last">
  1559. <p>The number of rendered points primitives per frame.</p>
  1560. </td>
  1561. </tr>
  1562. <tr>
  1563. <td class="name">
  1564. <strong>lines</strong>
  1565. <br>
  1566. <span class="param-type">number</span>
  1567. </td>
  1568. <td class="description last">
  1569. <p>The number of rendered lines primitives per frame.</p>
  1570. </td>
  1571. </tr>
  1572. </tbody>
  1573. </table>
  1574. </div>
  1575. <div class="member">
  1576. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  1577. <div class="description">
  1578. <p>WebGLRenderer options.</p>
  1579. </div>
  1580. <table class="props">
  1581. <tbody>
  1582. <tr>
  1583. <td class="name">
  1584. <strong>canvas</strong>
  1585. <br>
  1586. <span class="param-type">HTMLCanvasElement</span>
  1587. |
  1588. <span class="param-type">OffscreenCanvas</span>
  1589. </td>
  1590. <td class="description last">
  1591. <p>A canvas element where the renderer draws its output. If not passed in here, a new canvas element will be created by the renderer.</p>
  1592. <p>Default is <code>null</code>.</p>
  1593. </td>
  1594. </tr>
  1595. <tr>
  1596. <td class="name">
  1597. <strong>context</strong>
  1598. <br>
  1599. <span class="param-type">WebGL2RenderingContext</span>
  1600. </td>
  1601. <td class="description last">
  1602. <p>Can be used to attach an existing rendering context to this renderer.</p>
  1603. <p>Default is <code>null</code>.</p>
  1604. </td>
  1605. </tr>
  1606. <tr>
  1607. <td class="name">
  1608. <strong>precision</strong>
  1609. <br>
  1610. <span class="param-type">'highp'</span>
  1611. |
  1612. <span class="param-type">'mediump'</span>
  1613. |
  1614. <span class="param-type">'lowp'</span>
  1615. </td>
  1616. <td class="description last">
  1617. <p>The default shader precision. Uses <code>highp</code> if supported by the device.</p>
  1618. <p>Default is <code>'highp'</code>.</p>
  1619. </td>
  1620. </tr>
  1621. <tr>
  1622. <td class="name">
  1623. <strong>alpha</strong>
  1624. <br>
  1625. <span class="param-type">boolean</span>
  1626. </td>
  1627. <td class="description last">
  1628. <p>Controls the default clear alpha value. When set to<code>true</code>, the value is <code>0</code>. Otherwise it's <code>1</code>.</p>
  1629. <p>Default is <code>false</code>.</p>
  1630. </td>
  1631. </tr>
  1632. <tr>
  1633. <td class="name">
  1634. <strong>premultipliedAlpha</strong>
  1635. <br>
  1636. <span class="param-type">boolean</span>
  1637. </td>
  1638. <td class="description last">
  1639. <p>Whether the renderer will assume colors have premultiplied alpha or not.</p>
  1640. <p>Default is <code>true</code>.</p>
  1641. </td>
  1642. </tr>
  1643. <tr>
  1644. <td class="name">
  1645. <strong>antialias</strong>
  1646. <br>
  1647. <span class="param-type">boolean</span>
  1648. </td>
  1649. <td class="description last">
  1650. <p>Whether to use the default MSAA or not.</p>
  1651. <p>Default is <code>false</code>.</p>
  1652. </td>
  1653. </tr>
  1654. <tr>
  1655. <td class="name">
  1656. <strong>stencil</strong>
  1657. <br>
  1658. <span class="param-type">boolean</span>
  1659. </td>
  1660. <td class="description last">
  1661. <p>Whether the drawing buffer has a stencil buffer of at least 8 bits or not.</p>
  1662. <p>Default is <code>false</code>.</p>
  1663. </td>
  1664. </tr>
  1665. <tr>
  1666. <td class="name">
  1667. <strong>preserveDrawingBuffer</strong>
  1668. <br>
  1669. <span class="param-type">boolean</span>
  1670. </td>
  1671. <td class="description last">
  1672. <p>Whether to preserve the buffer until manually cleared or overwritten.</p>
  1673. <p>Default is <code>false</code>.</p>
  1674. </td>
  1675. </tr>
  1676. <tr>
  1677. <td class="name">
  1678. <strong>powerPreference</strong>
  1679. <br>
  1680. <span class="param-type">'default'</span>
  1681. |
  1682. <span class="param-type">'low-power'</span>
  1683. |
  1684. <span class="param-type">'high-performance'</span>
  1685. </td>
  1686. <td class="description last">
  1687. <p>Provides a hint to the user agent indicating what configuration of GPU is suitable for this WebGL context.</p>
  1688. <p>Default is <code>'default'</code>.</p>
  1689. </td>
  1690. </tr>
  1691. <tr>
  1692. <td class="name">
  1693. <strong>failIfMajorPerformanceCaveat</strong>
  1694. <br>
  1695. <span class="param-type">boolean</span>
  1696. </td>
  1697. <td class="description last">
  1698. <p>Whether the renderer creation will fail upon low performance is detected.</p>
  1699. <p>Default is <code>false</code>.</p>
  1700. </td>
  1701. </tr>
  1702. <tr>
  1703. <td class="name">
  1704. <strong>depth</strong>
  1705. <br>
  1706. <span class="param-type">boolean</span>
  1707. </td>
  1708. <td class="description last">
  1709. <p>Whether the drawing buffer has a depth buffer of at least 16 bits.</p>
  1710. <p>Default is <code>true</code>.</p>
  1711. </td>
  1712. </tr>
  1713. <tr>
  1714. <td class="name">
  1715. <strong>logarithmicDepthBuffer</strong>
  1716. <br>
  1717. <span class="param-type">boolean</span>
  1718. </td>
  1719. <td class="description last">
  1720. <p>Whether to use a logarithmic depth buffer. It may be necessary to use this if dealing with huge differences in scale in a single scene.
  1721. Note that this setting uses <code>gl_FragDepth</code> if available which disables the Early Fragment Test optimization and can cause a decrease in performance.</p>
  1722. <p>Default is <code>false</code>.</p>
  1723. </td>
  1724. </tr>
  1725. <tr>
  1726. <td class="name">
  1727. <strong>reversedDepthBuffer</strong>
  1728. <br>
  1729. <span class="param-type">boolean</span>
  1730. </td>
  1731. <td class="description last">
  1732. <p>Whether to use a reverse depth buffer. Requires the <code>EXT_clip_control</code> extension.
  1733. This is a more faster and accurate version than logarithmic depth buffer.</p>
  1734. <p>Default is <code>false</code>.</p>
  1735. </td>
  1736. </tr>
  1737. </tbody>
  1738. </table>
  1739. </div>
  1740. <div class="member">
  1741. <h3 class="name" id="~ShadowMap" translate="no">.<a href="#~ShadowMap">ShadowMap</a> </h3>
  1742. <div class="description">
  1743. <p>WebGLRenderer Shadow Map.</p>
  1744. </div>
  1745. <table class="props">
  1746. <tbody>
  1747. <tr>
  1748. <td class="name">
  1749. <strong>enabled</strong>
  1750. <br>
  1751. <span class="param-type">boolean</span>
  1752. </td>
  1753. <td class="description last">
  1754. <p>If set to <code>true</code>, use shadow maps in the scene.</p>
  1755. <p>Default is <code>false</code>.</p>
  1756. </td>
  1757. </tr>
  1758. <tr>
  1759. <td class="name">
  1760. <strong>autoUpdate</strong>
  1761. <br>
  1762. <span class="param-type">boolean</span>
  1763. </td>
  1764. <td class="description last">
  1765. <p>Enables automatic updates to the shadows in the scene.
  1766. If you do not require dynamic lighting / shadows, you may set this to <code>false</code>.</p>
  1767. <p>Default is <code>true</code>.</p>
  1768. </td>
  1769. </tr>
  1770. <tr>
  1771. <td class="name">
  1772. <strong>needsUpdate</strong>
  1773. <br>
  1774. <span class="param-type">boolean</span>
  1775. </td>
  1776. <td class="description last">
  1777. <p>When set to <code>true</code>, shadow maps in the scene
  1778. will be updated in the next <code>render</code> call.</p>
  1779. <p>Default is <code>false</code>.</p>
  1780. </td>
  1781. </tr>
  1782. <tr>
  1783. <td class="name">
  1784. <strong>type</strong>
  1785. <br>
  1786. <span class="param-type"><a href="global.html#BasicShadowMap">BasicShadowMap</a></span>
  1787. |
  1788. <span class="param-type"><a href="global.html#PCFShadowMap">PCFShadowMap</a></span>
  1789. |
  1790. <span class="param-type"><a href="global.html#VSMShadowMap">VSMShadowMap</a></span>
  1791. </td>
  1792. <td class="description last">
  1793. <p>Defines the shadow map type.</p>
  1794. <p>Default is <code>PCFShadowMap</code>.</p>
  1795. </td>
  1796. </tr>
  1797. </tbody>
  1798. </table>
  1799. </div>
  1800. <h2 class="subsection-title">Source</h2>
  1801. <p>
  1802. <a href="https://github.com/mrdoob/three.js/blob/master/src/renderers/WebGLRenderer.js" translate="no" target="_blank" rel="noopener">src/renderers/WebGLRenderer.js</a>
  1803. </p>
  1804. </article>
  1805. </section>
  1806. <script src="../scripts/linenumber.js"></script>
  1807. <script src="../scripts/page.js"></script>
  1808. </body>
  1809. </html>
粤ICP备19079148号