Renderer.html 81 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Renderer - 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">Renderer</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Base class for renderers.</p></div>
  16. </header>
  17. <article>
  18. <div class="container-overview">
  19. <h2>Constructor</h2>
  20. <h3 class="name name-method" id="Renderer" translate="no">new <a href="#Renderer">Renderer</a><span class="signature">( backend : <span class="param-type"><a href="Backend.html">Backend</a></span>, parameters : <span class="param-type"><a href="Renderer.html#~Options">Renderer~Options</a></span> )</span> </h3>
  21. <div class="method">
  22. <div class="description">
  23. <p>Constructs a new renderer.</p>
  24. </div>
  25. <table class="params">
  26. <tbody>
  27. <tr>
  28. <td class="name">
  29. <strong>backend</strong>
  30. </td>
  31. <td class="description last">
  32. <p>The backend the renderer is targeting (e.g. WebGPU or WebGL 2).</p>
  33. </td>
  34. </tr>
  35. <tr>
  36. <td class="name">
  37. <strong>parameters</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The configuration parameter.</p>
  41. </td>
  42. </tr>
  43. </tbody>
  44. </table>
  45. </div>
  46. </div>
  47. <h2 class="subsection-title">Properties</h2>
  48. <div class="member">
  49. <h3 class="name" id="alpha" translate="no">.<a href="#alpha">alpha</a><span class="type-signature"> : boolean</span> </h3>
  50. <div class="description">
  51. <p>Whether the default framebuffer should be transparent or opaque.</p>
  52. <p>Default is <code>true</code>.</p>
  53. </div>
  54. </div>
  55. <div class="member">
  56. <h3 class="name" id="autoClear" translate="no">.<a href="#autoClear">autoClear</a><span class="type-signature"> : boolean</span> </h3>
  57. <div class="description">
  58. <p>Whether the renderer should automatically clear the current rendering target
  59. before execute a <code>render()</code> call. The target can be the canvas (default framebuffer)
  60. or the current bound render target (custom framebuffer).</p>
  61. <p>Default is <code>true</code>.</p>
  62. </div>
  63. </div>
  64. <div class="member">
  65. <h3 class="name" id="autoClearColor" translate="no">.<a href="#autoClearColor">autoClearColor</a><span class="type-signature"> : boolean</span> </h3>
  66. <div class="description">
  67. <p>When <code>autoClear</code> is set to <code>true</code>, this property defines whether the renderer
  68. should clear the color buffer.</p>
  69. <p>Default is <code>true</code>.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="autoClearDepth" translate="no">.<a href="#autoClearDepth">autoClearDepth</a><span class="type-signature"> : boolean</span> </h3>
  74. <div class="description">
  75. <p>When <code>autoClear</code> is set to <code>true</code>, this property defines whether the renderer
  76. should clear the depth buffer.</p>
  77. <p>Default is <code>true</code>.</p>
  78. </div>
  79. </div>
  80. <div class="member">
  81. <h3 class="name" id="autoClearStencil" translate="no">.<a href="#autoClearStencil">autoClearStencil</a><span class="type-signature"> : boolean</span> </h3>
  82. <div class="description">
  83. <p>When <code>autoClear</code> is set to <code>true</code>, this property defines whether the renderer
  84. should clear the stencil buffer.</p>
  85. <p>Default is <code>true</code>.</p>
  86. </div>
  87. </div>
  88. <div class="member">
  89. <h3 class="name" id="backend" translate="no">.<a href="#backend">backend</a><span class="type-signature"> : <a href="Backend.html">Backend</a></span> </h3>
  90. <div class="description">
  91. <p>A reference to the current backend.</p>
  92. </div>
  93. </div>
  94. <div class="member">
  95. <h3 class="name" id="contextNode" translate="no">.<a href="#contextNode">contextNode</a><span class="type-signature"> : <a href="ContextNode.html">ContextNode</a></span> </h3>
  96. <div class="description">
  97. <p>A global context node that stores override nodes for specific transformations or calculations.
  98. These nodes can be used to replace default behavior in the rendering pipeline.</p>
  99. </div>
  100. <table class="props">
  101. <tbody>
  102. <tr>
  103. <td class="name">
  104. <strong>value</strong>
  105. <br>
  106. <span class="param-type">Object</span>
  107. </td>
  108. <td class="description last">
  109. <p>The context value object.</p>
  110. </td>
  111. </tr>
  112. </tbody>
  113. </table>
  114. </div>
  115. <div class="member">
  116. <h3 class="name" id="coordinateSystem" translate="no">.<a href="#coordinateSystem">coordinateSystem</a><span class="type-signature"> : number</span> <span class="type-signature">(readonly) </span></h3>
  117. <div class="description">
  118. <p>The coordinate system of the renderer. The value of this property
  119. depends on the selected backend. Either <code>THREE.WebGLCoordinateSystem</code> or
  120. <code>THREE.WebGPUCoordinateSystem</code>.</p>
  121. </div>
  122. </div>
  123. <div class="member">
  124. <h3 class="name" id="currentColorSpace" translate="no">.<a href="#currentColorSpace">currentColorSpace</a><span class="type-signature"> : string</span> </h3>
  125. <div class="description">
  126. <p>The current color space of the renderer. When not producing screen output,
  127. the color space is always the working color space.</p>
  128. </div>
  129. </div>
  130. <div class="member">
  131. <h3 class="name" id="currentSamples" translate="no">.<a href="#currentSamples">currentSamples</a><span class="type-signature"> : number</span> </h3>
  132. <div class="description">
  133. <p>The current number of samples used for multi-sample anti-aliasing (MSAA).</p>
  134. <p>When rendering to a custom render target, the number of samples of that render target is used.
  135. If the renderer needs an internal framebuffer target for tone mapping or color space conversion,
  136. the number of samples is set to 0.</p>
  137. </div>
  138. </div>
  139. <div class="member">
  140. <h3 class="name" id="currentToneMapping" translate="no">.<a href="#currentToneMapping">currentToneMapping</a><span class="type-signature"> : number</span> </h3>
  141. <div class="description">
  142. <p>The current tone mapping of the renderer. When not producing screen output,
  143. the tone mapping is always <code>NoToneMapping</code>.</p>
  144. </div>
  145. </div>
  146. <div class="member">
  147. <h3 class="name" id="debug" translate="no">.<a href="#debug">debug</a><span class="type-signature"> : <a href="global.html#DebugConfig">DebugConfig</a></span> </h3>
  148. <div class="description">
  149. <p>The renderer's debug configuration.</p>
  150. </div>
  151. </div>
  152. <div class="member">
  153. <h3 class="name" id="depth" translate="no">.<a href="#depth">depth</a><span class="type-signature"> : boolean</span> </h3>
  154. <div class="description">
  155. <p>Whether the default framebuffer should have a depth buffer or not.</p>
  156. <p>Default is <code>true</code>.</p>
  157. </div>
  158. </div>
  159. <div class="member">
  160. <h3 class="name" id="domElement" translate="no">.<a href="#domElement">domElement</a><span class="type-signature"> : HTMLCanvasElement | OffscreenCanvas</span> </h3>
  161. <div class="description">
  162. <p>A reference to the canvas element the renderer is drawing to.
  163. This value of this property will automatically be created by
  164. the renderer.</p>
  165. </div>
  166. </div>
  167. <div class="member">
  168. <h3 class="name" id="highPrecision" translate="no">.<a href="#highPrecision">highPrecision</a><span class="type-signature"> : boolean</span> </h3>
  169. <div class="description">
  170. <p>Enables or disables high precision for model-view and normal-view matrices.
  171. When enabled, will use CPU 64-bit precision for higher precision instead of GPU 32-bit for higher performance.</p>
  172. <p>NOTE: 64-bit precision is not compatible with <code>InstancedMesh</code> and <code>SkinnedMesh</code>.</p>
  173. </div>
  174. </div>
  175. <div class="member">
  176. <h3 class="name" id="highPrecision" translate="no">.<a href="#highPrecision">highPrecision</a><span class="type-signature"> : boolean</span> </h3>
  177. <div class="description">
  178. <p>Returns whether high precision is enabled or not.</p>
  179. </div>
  180. </div>
  181. <div class="member">
  182. <h3 class="name" id="info" translate="no">.<a href="#info">info</a><span class="type-signature"> : <a href="Info.html">Info</a></span> </h3>
  183. <div class="description">
  184. <p>Holds a series of statistical information about the GPU memory
  185. and the rendering process. Useful for debugging and monitoring.</p>
  186. </div>
  187. </div>
  188. <div class="member">
  189. <h3 class="name" id="initialized" translate="no">.<a href="#initialized">initialized</a> <span class="type-signature">(readonly) </span></h3>
  190. <div class="description">
  191. <p>Returns whether the renderer has been initialized or not.</p>
  192. </div>
  193. </div>
  194. <div class="member">
  195. <h3 class="name" id="inspector" translate="no">.<a href="#inspector">inspector</a><span class="type-signature"> : <a href="InspectorBase.html">InspectorBase</a></span> </h3>
  196. <div class="description">
  197. <p>The inspector instance. The inspector can be any class that extends from <code>InspectorBase</code>.</p>
  198. </div>
  199. </div>
  200. <div class="member">
  201. <h3 class="name" id="isOutputTarget" translate="no">.<a href="#isOutputTarget">isOutputTarget</a> </h3>
  202. <div class="description">
  203. <p>Returns <code>true</code> if the rendering settings are set to screen output.</p>
  204. </div>
  205. </div>
  206. <div class="member">
  207. <h3 class="name" id="isRenderer" translate="no">.<a href="#isRenderer">isRenderer</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  208. <div class="description">
  209. <p>This flag can be used for type testing.</p>
  210. <p>Default is <code>true</code>.</p>
  211. </div>
  212. </div>
  213. <div class="member">
  214. <h3 class="name" id="library" translate="no">.<a href="#library">library</a><span class="type-signature"> : <a href="NodeLibrary.html">NodeLibrary</a></span> </h3>
  215. <div class="description">
  216. <p>The node library defines how certain library objects like materials, lights
  217. or tone mapping functions are mapped to node types. This is required since
  218. although instances of classes like <code>MeshBasicMaterial</code> or <code>PointLight</code> can
  219. be part of the scene graph, they are internally represented as nodes for
  220. further processing.</p>
  221. </div>
  222. </div>
  223. <div class="member">
  224. <h3 class="name" id="lighting" translate="no">.<a href="#lighting">lighting</a><span class="type-signature"> : <a href="Lighting.html">Lighting</a></span> </h3>
  225. <div class="description">
  226. <p>A map-like data structure for managing lights.</p>
  227. </div>
  228. </div>
  229. <div class="member">
  230. <h3 class="name" id="logarithmicDepthBuffer" translate="no">.<a href="#logarithmicDepthBuffer">logarithmicDepthBuffer</a><span class="type-signature"> : boolean</span> </h3>
  231. <div class="description">
  232. <p>Whether logarithmic depth buffer is enabled or not.</p>
  233. <p>Default is <code>false</code>.</p>
  234. </div>
  235. </div>
  236. <div class="member">
  237. <h3 class="name" id="needsFrameBufferTarget" translate="no">.<a href="#needsFrameBufferTarget">needsFrameBufferTarget</a> </h3>
  238. <div class="description">
  239. <p>Returns <code>true</code> if a framebuffer target is needed to perform tone mapping or color space conversion.
  240. If this is the case, the renderer allocates an internal render target for that purpose.</p>
  241. </div>
  242. </div>
  243. <div class="member">
  244. <h3 class="name" id="onDeviceLost" translate="no">.<a href="#onDeviceLost">onDeviceLost</a><span class="type-signature"> : function</span> </h3>
  245. <div class="description">
  246. <p>A callback function that defines what should happen when a device/context lost occurs.</p>
  247. </div>
  248. </div>
  249. <div class="member">
  250. <h3 class="name" id="opaque" translate="no">.<a href="#opaque">opaque</a><span class="type-signature"> : boolean</span> </h3>
  251. <div class="description">
  252. <p>Whether the renderer should render opaque render objects or not.</p>
  253. <p>Default is <code>true</code>.</p>
  254. </div>
  255. </div>
  256. <div class="member">
  257. <h3 class="name" id="outputColorSpace" translate="no">.<a href="#outputColorSpace">outputColorSpace</a><span class="type-signature"> : string</span> </h3>
  258. <div class="description">
  259. <p>Defines the output color space of the renderer.</p>
  260. <p>Default is <code>SRGBColorSpace</code>.</p>
  261. </div>
  262. </div>
  263. <div class="member">
  264. <h3 class="name" id="samples" translate="no">.<a href="#samples">samples</a><span class="type-signature"> : number</span> </h3>
  265. <div class="description">
  266. <p>The number of samples used for multi-sample anti-aliasing (MSAA).</p>
  267. <p>Default is <code>0</code>.</p>
  268. </div>
  269. </div>
  270. <div class="member">
  271. <h3 class="name" id="shadowMap" translate="no">.<a href="#shadowMap">shadowMap</a><span class="type-signature"> : <a href="global.html#ShadowMapConfig">ShadowMapConfig</a></span> </h3>
  272. <div class="description">
  273. <p>The renderer's shadow configuration.</p>
  274. </div>
  275. </div>
  276. <div class="member">
  277. <h3 class="name" id="sortObjects" translate="no">.<a href="#sortObjects">sortObjects</a><span class="type-signature"> : boolean</span> </h3>
  278. <div class="description">
  279. <p>Whether the renderer should sort its render lists or not.</p>
  280. <p>Note: Sorting is used to attempt to properly render objects that have some degree of transparency.
  281. By definition, sorting objects may not work in all cases. Depending on the needs of application,
  282. it may be necessary to turn off sorting and use other methods to deal with transparency rendering
  283. e.g. manually determining each object's rendering order.</p>
  284. <p>Default is <code>true</code>.</p>
  285. </div>
  286. </div>
  287. <div class="member">
  288. <h3 class="name" id="stencil" translate="no">.<a href="#stencil">stencil</a><span class="type-signature"> : boolean</span> </h3>
  289. <div class="description">
  290. <p>Whether the default framebuffer should have a stencil buffer or not.</p>
  291. <p>Default is <code>false</code>.</p>
  292. </div>
  293. </div>
  294. <div class="member">
  295. <h3 class="name" id="toneMapping" translate="no">.<a href="#toneMapping">toneMapping</a><span class="type-signature"> : number</span> </h3>
  296. <div class="description">
  297. <p>Defines the tone mapping of the renderer.</p>
  298. <p>Default is <code>NoToneMapping</code>.</p>
  299. </div>
  300. </div>
  301. <div class="member">
  302. <h3 class="name" id="toneMappingExposure" translate="no">.<a href="#toneMappingExposure">toneMappingExposure</a><span class="type-signature"> : number</span> </h3>
  303. <div class="description">
  304. <p>Defines the tone mapping exposure.</p>
  305. <p>Default is <code>1</code>.</p>
  306. </div>
  307. </div>
  308. <div class="member">
  309. <h3 class="name" id="transparent" translate="no">.<a href="#transparent">transparent</a><span class="type-signature"> : boolean</span> </h3>
  310. <div class="description">
  311. <p>Whether the renderer should render transparent render objects or not.</p>
  312. <p>Default is <code>true</code>.</p>
  313. </div>
  314. </div>
  315. <div class="member">
  316. <h3 class="name" id="xr" translate="no">.<a href="#xr">xr</a><span class="type-signature"> : <a href="XRManager.html">XRManager</a></span> </h3>
  317. <div class="description">
  318. <p>The renderer's XR manager.</p>
  319. </div>
  320. </div>
  321. <h2 class="subsection-title">Methods</h2>
  322. <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>
  323. <div class="method">
  324. <div class="description">
  325. <p>Performs a manual clear operation. This method ignores <code>autoClear</code> properties.</p>
  326. </div>
  327. <table class="params">
  328. <tbody>
  329. <tr>
  330. <td class="name">
  331. <strong>color</strong>
  332. </td>
  333. <td class="description last">
  334. <p>Whether the color buffer should be cleared or not.</p>
  335. <p>Default is <code>true</code>.</p>
  336. </td>
  337. </tr>
  338. <tr>
  339. <td class="name">
  340. <strong>depth</strong>
  341. </td>
  342. <td class="description last">
  343. <p>Whether the depth buffer should be cleared or not.</p>
  344. <p>Default is <code>true</code>.</p>
  345. </td>
  346. </tr>
  347. <tr>
  348. <td class="name">
  349. <strong>stencil</strong>
  350. </td>
  351. <td class="description last">
  352. <p>Whether the stencil buffer should be cleared or not.</p>
  353. <p>Default is <code>true</code>.</p>
  354. </td>
  355. </tr>
  356. </tbody>
  357. </table>
  358. </div>
  359. <h3 class="name name-method" id="clearAsync" translate="no">.<a href="#clearAsync">clearAsync</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><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  360. <div class="method">
  361. <div class="description">
  362. <p>Async version of <a href="Renderer.html#clear">Renderer#clear</a>.</p>
  363. </div>
  364. <table class="params">
  365. <tbody>
  366. <tr>
  367. <td class="name">
  368. <strong>color</strong>
  369. </td>
  370. <td class="description last">
  371. <p>Whether the color buffer should be cleared or not.</p>
  372. <p>Default is <code>true</code>.</p>
  373. </td>
  374. </tr>
  375. <tr>
  376. <td class="name">
  377. <strong>depth</strong>
  378. </td>
  379. <td class="description last">
  380. <p>Whether the depth buffer should be cleared or not.</p>
  381. <p>Default is <code>true</code>.</p>
  382. </td>
  383. </tr>
  384. <tr>
  385. <td class="name">
  386. <strong>stencil</strong>
  387. </td>
  388. <td class="description last">
  389. <p>Whether the stencil buffer should be cleared or not.</p>
  390. <p>Default is <code>true</code>.</p>
  391. </td>
  392. </tr>
  393. </tbody>
  394. </table>
  395. <dl class="details">
  396. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  397. </dl>
  398. <dl class="details">
  399. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the clear operation has been executed.</dt>
  400. </dl>
  401. </div>
  402. <h3 class="name name-method" id="clearColor" translate="no">.<a href="#clearColor">clearColor</a><span class="signature">()</span> </h3>
  403. <div class="method">
  404. <div class="description">
  405. <p>Performs a manual clear operation of the color buffer. This method ignores <code>autoClear</code> properties.</p>
  406. </div>
  407. </div>
  408. <h3 class="name name-method" id="clearColorAsync" translate="no">.<a href="#clearColorAsync">clearColorAsync</a><span class="signature">()</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  409. <div class="method">
  410. <div class="description">
  411. <p>Async version of <a href="Renderer.html#clearColor">Renderer#clearColor</a>.</p>
  412. </div>
  413. <dl class="details">
  414. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  415. </dl>
  416. <dl class="details">
  417. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the clear operation has been executed.</dt>
  418. </dl>
  419. </div>
  420. <h3 class="name name-method" id="clearDepth" translate="no">.<a href="#clearDepth">clearDepth</a><span class="signature">()</span> </h3>
  421. <div class="method">
  422. <div class="description">
  423. <p>Performs a manual clear operation of the depth buffer. This method ignores <code>autoClear</code> properties.</p>
  424. </div>
  425. </div>
  426. <h3 class="name name-method" id="clearDepthAsync" translate="no">.<a href="#clearDepthAsync">clearDepthAsync</a><span class="signature">()</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  427. <div class="method">
  428. <div class="description">
  429. <p>Async version of <a href="Renderer.html#clearDepth">Renderer#clearDepth</a>.</p>
  430. </div>
  431. <dl class="details">
  432. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  433. </dl>
  434. <dl class="details">
  435. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the clear operation has been executed.</dt>
  436. </dl>
  437. </div>
  438. <h3 class="name name-method" id="clearStencil" translate="no">.<a href="#clearStencil">clearStencil</a><span class="signature">()</span> </h3>
  439. <div class="method">
  440. <div class="description">
  441. <p>Performs a manual clear operation of the stencil buffer. This method ignores <code>autoClear</code> properties.</p>
  442. </div>
  443. </div>
  444. <h3 class="name name-method" id="clearStencilAsync" translate="no">.<a href="#clearStencilAsync">clearStencilAsync</a><span class="signature">()</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  445. <div class="method">
  446. <div class="description">
  447. <p>Async version of <a href="Renderer.html#clearStencil">Renderer#clearStencil</a>.</p>
  448. </div>
  449. <dl class="details">
  450. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  451. </dl>
  452. <dl class="details">
  453. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the clear operation has been executed.</dt>
  454. </dl>
  455. </div>
  456. <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"> : function</span> </h3>
  457. <div class="method">
  458. <div class="description">
  459. <p>Alias for <code>compileAsync()</code>.</p>
  460. </div>
  461. <table class="params">
  462. <tbody>
  463. <tr>
  464. <td class="name">
  465. <strong>scene</strong>
  466. </td>
  467. <td class="description last">
  468. <p>The scene or 3D object to precompile.</p>
  469. </td>
  470. </tr>
  471. <tr>
  472. <td class="name">
  473. <strong>camera</strong>
  474. </td>
  475. <td class="description last">
  476. <p>The camera that is used to render the scene.</p>
  477. </td>
  478. </tr>
  479. <tr>
  480. <td class="name">
  481. <strong>targetScene</strong>
  482. </td>
  483. <td class="description last">
  484. <p>If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added.</p>
  485. </td>
  486. </tr>
  487. </tbody>
  488. </table>
  489. <dl class="details">
  490. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the compile has been finished.</dt>
  491. </dl>
  492. </div>
  493. <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>
  494. <div class="method">
  495. <div class="description">
  496. <p>Compiles all materials in the given scene. This can be useful to avoid a
  497. phenomenon which is called &quot;shader compilation stutter&quot;, which occurs when
  498. rendering an object with a new shader for the first time.</p>
  499. <p>If you want to add a 3D object to an existing scene, use the third optional
  500. parameter for applying the target scene. Note that the (target) scene's lighting
  501. and environment must be configured before calling this method.</p>
  502. </div>
  503. <table class="params">
  504. <tbody>
  505. <tr>
  506. <td class="name">
  507. <strong>scene</strong>
  508. </td>
  509. <td class="description last">
  510. <p>The scene or 3D object to precompile.</p>
  511. </td>
  512. </tr>
  513. <tr>
  514. <td class="name">
  515. <strong>camera</strong>
  516. </td>
  517. <td class="description last">
  518. <p>The camera that is used to render the scene.</p>
  519. </td>
  520. </tr>
  521. <tr>
  522. <td class="name">
  523. <strong>targetScene</strong>
  524. </td>
  525. <td class="description last">
  526. <p>If the first argument is a 3D object, this parameter must represent the scene the 3D object is going to be added.</p>
  527. <p>Default is <code>null</code>.</p>
  528. </td>
  529. </tr>
  530. </tbody>
  531. </table>
  532. <dl class="details">
  533. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the compile has been finished.</dt>
  534. </dl>
  535. </div>
  536. <h3 class="name name-method" id="compute" translate="no">.<a href="#compute">compute</a><span class="signature">( computeNodes : <span class="param-type"><a href="Node.html">Node</a> | Array.&lt;<a href="Node.html">Node</a>></span>, dispatchSize : <span class="param-type">number | Array.&lt;number> | <a href="IndirectStorageBufferAttribute.html">IndirectStorageBufferAttribute</a></span> )</span><span class="type-signature"> : Promise | undefined</span> </h3>
  537. <div class="method">
  538. <div class="description">
  539. <p>Execute a single or an array of compute nodes. This method can only be called
  540. if the renderer has been initialized.</p>
  541. </div>
  542. <table class="params">
  543. <tbody>
  544. <tr>
  545. <td class="name">
  546. <strong>computeNodes</strong>
  547. </td>
  548. <td class="description last">
  549. <p>The compute node(s).</p>
  550. </td>
  551. </tr>
  552. <tr>
  553. <td class="name">
  554. <strong>dispatchSize</strong>
  555. </td>
  556. <td class="description last">
  557. <ul>
  558. <li>A single number representing count, or</li>
  559. <li>An array [x, y, z] representing dispatch size, or</li>
  560. <li>A IndirectStorageBufferAttribute for indirect dispatch size.</li>
  561. </ul>
  562. <p>Default is <code>null</code>.</p>
  563. </td>
  564. </tr>
  565. </tbody>
  566. </table>
  567. <dl class="details">
  568. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolve when the compute has finished. Only returned when the renderer has not been initialized.</dt>
  569. </dl>
  570. </div>
  571. <h3 class="name name-method" id="computeAsync" translate="no">.<a href="#computeAsync">computeAsync</a><span class="signature">( computeNodes : <span class="param-type"><a href="Node.html">Node</a> | Array.&lt;<a href="Node.html">Node</a>></span>, dispatchSize : <span class="param-type">number | Array.&lt;number> | <a href="IndirectStorageBufferAttribute.html">IndirectStorageBufferAttribute</a></span> )</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  572. <div class="method">
  573. <div class="description">
  574. <p>Execute a single or an array of compute nodes.</p>
  575. </div>
  576. <table class="params">
  577. <tbody>
  578. <tr>
  579. <td class="name">
  580. <strong>computeNodes</strong>
  581. </td>
  582. <td class="description last">
  583. <p>The compute node(s).</p>
  584. </td>
  585. </tr>
  586. <tr>
  587. <td class="name">
  588. <strong>dispatchSize</strong>
  589. </td>
  590. <td class="description last">
  591. <ul>
  592. <li>A single number representing count, or</li>
  593. <li>An array [x, y, z] representing dispatch size, or</li>
  594. <li>A IndirectStorageBufferAttribute for indirect dispatch size.</li>
  595. </ul>
  596. <p>Default is <code>null</code>.</p>
  597. </td>
  598. </tr>
  599. </tbody>
  600. </table>
  601. <dl class="details">
  602. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolve when the compute has finished.</dt>
  603. </dl>
  604. </div>
  605. <h3 class="name name-method" id="copyFramebufferToTexture" translate="no">.<a href="#copyFramebufferToTexture">copyFramebufferToTexture</a><span class="signature">( framebufferTexture : <span class="param-type"><a href="FramebufferTexture.html">FramebufferTexture</a></span>, rectangle : <span class="param-type"><a href="Vector2.html">Vector2</a> | <a href="Vector4.html">Vector4</a></span> )</span> </h3>
  606. <div class="method">
  607. <div class="description">
  608. <p>Copies the current bound framebuffer into the given texture.</p>
  609. </div>
  610. <table class="params">
  611. <tbody>
  612. <tr>
  613. <td class="name">
  614. <strong>framebufferTexture</strong>
  615. </td>
  616. <td class="description last">
  617. <p>The texture.</p>
  618. </td>
  619. </tr>
  620. <tr>
  621. <td class="name">
  622. <strong>rectangle</strong>
  623. </td>
  624. <td class="description last">
  625. <p>A two or four dimensional vector that defines the rectangular portion of the framebuffer that should be copied.</p>
  626. <p>Default is <code>null</code>.</p>
  627. </td>
  628. </tr>
  629. </tbody>
  630. </table>
  631. </div>
  632. <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>
  633. <div class="method">
  634. <div class="description">
  635. <p>Copies data of the given source texture into a destination texture.</p>
  636. </div>
  637. <table class="params">
  638. <tbody>
  639. <tr>
  640. <td class="name">
  641. <strong>srcTexture</strong>
  642. </td>
  643. <td class="description last">
  644. <p>The source texture.</p>
  645. </td>
  646. </tr>
  647. <tr>
  648. <td class="name">
  649. <strong>dstTexture</strong>
  650. </td>
  651. <td class="description last">
  652. <p>The destination texture.</p>
  653. </td>
  654. </tr>
  655. <tr>
  656. <td class="name">
  657. <strong>srcRegion</strong>
  658. </td>
  659. <td class="description last">
  660. <p>A bounding box which describes the source region. Can be two or three-dimensional.</p>
  661. <p>Default is <code>null</code>.</p>
  662. </td>
  663. </tr>
  664. <tr>
  665. <td class="name">
  666. <strong>dstPosition</strong>
  667. </td>
  668. <td class="description last">
  669. <p>A vector that represents the origin of the destination region. Can be two or three-dimensional.</p>
  670. <p>Default is <code>null</code>.</p>
  671. </td>
  672. </tr>
  673. <tr>
  674. <td class="name">
  675. <strong>srcLevel</strong>
  676. </td>
  677. <td class="description last">
  678. <p>The source mip level to copy from.</p>
  679. <p>Default is <code>0</code>.</p>
  680. </td>
  681. </tr>
  682. <tr>
  683. <td class="name">
  684. <strong>dstLevel</strong>
  685. </td>
  686. <td class="description last">
  687. <p>The destination mip level to copy to.</p>
  688. <p>Default is <code>0</code>.</p>
  689. </td>
  690. </tr>
  691. </tbody>
  692. </table>
  693. </div>
  694. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> </h3>
  695. <div class="method">
  696. <div class="description">
  697. <p>Frees all internal resources of the renderer. Call this method if the renderer
  698. is no longer in use by your app.</p>
  699. </div>
  700. </div>
  701. <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>
  702. <div class="method">
  703. <div class="description">
  704. <p>Returns the active cube face.</p>
  705. </div>
  706. <dl class="details">
  707. <dt class="tag-returns"><strong>Returns:</strong> The active cube face.</dt>
  708. </dl>
  709. </div>
  710. <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>
  711. <div class="method">
  712. <div class="description">
  713. <p>Returns the active mipmap level.</p>
  714. </div>
  715. <dl class="details">
  716. <dt class="tag-returns"><strong>Returns:</strong> The active mipmap level.</dt>
  717. </dl>
  718. </div>
  719. <h3 class="name name-method" id="getAnimationLoop" translate="no">.<a href="#getAnimationLoop">getAnimationLoop</a><span class="signature">()</span><span class="type-signature"> : function</span> </h3>
  720. <div class="method">
  721. <div class="description">
  722. <p>Returns the current animation loop callback.</p>
  723. </div>
  724. <dl class="details">
  725. <dt class="tag-returns"><strong>Returns:</strong> The current animation loop callback.</dt>
  726. </dl>
  727. </div>
  728. <h3 class="name name-method" id="getArrayBufferAsync" translate="no">.<a href="#getArrayBufferAsync">getArrayBufferAsync</a><span class="signature">( attribute : <span class="param-type"><a href="StorageBufferAttribute.html">StorageBufferAttribute</a></span> )</span><span class="type-signature"> : Promise.&lt;ArrayBuffer></span> <span class="type-signature">(async) </span></h3>
  729. <div class="method">
  730. <div class="description">
  731. <p>Can be used to transfer buffer data from a storage buffer attribute
  732. from the GPU to the CPU in context of compute shaders.</p>
  733. </div>
  734. <table class="params">
  735. <tbody>
  736. <tr>
  737. <td class="name">
  738. <strong>attribute</strong>
  739. </td>
  740. <td class="description last">
  741. <p>The storage buffer attribute.</p>
  742. </td>
  743. </tr>
  744. </tbody>
  745. </table>
  746. <dl class="details">
  747. <dt class="tag-returns"><strong>Returns:</strong> A promise that resolves with the buffer data when the data are ready.</dt>
  748. </dl>
  749. </div>
  750. <h3 class="name name-method" id="getCanvasTarget" translate="no">.<a href="#getCanvasTarget">getCanvasTarget</a><span class="signature">()</span><span class="type-signature"> : <a href="CanvasTarget.html">CanvasTarget</a></span> </h3>
  751. <div class="method">
  752. <div class="description">
  753. <p>Returns the current canvas target.</p>
  754. </div>
  755. <dl class="details">
  756. <dt class="tag-returns"><strong>Returns:</strong> The current canvas target.</dt>
  757. </dl>
  758. </div>
  759. <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>
  760. <div class="method">
  761. <div class="description">
  762. <p>Returns the clear alpha.</p>
  763. </div>
  764. <dl class="details">
  765. <dt class="tag-returns"><strong>Returns:</strong> The clear alpha.</dt>
  766. </dl>
  767. </div>
  768. <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>
  769. <div class="method">
  770. <div class="description">
  771. <p>Returns the clear color.</p>
  772. </div>
  773. <table class="params">
  774. <tbody>
  775. <tr>
  776. <td class="name">
  777. <strong>target</strong>
  778. </td>
  779. <td class="description last">
  780. <p>The method writes the result in this target object.</p>
  781. </td>
  782. </tr>
  783. </tbody>
  784. </table>
  785. <dl class="details">
  786. <dt class="tag-returns"><strong>Returns:</strong> The clear color.</dt>
  787. </dl>
  788. </div>
  789. <h3 class="name name-method" id="getClearDepth" translate="no">.<a href="#getClearDepth">getClearDepth</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  790. <div class="method">
  791. <div class="description">
  792. <p>Returns the clear depth.</p>
  793. </div>
  794. <dl class="details">
  795. <dt class="tag-returns"><strong>Returns:</strong> The clear depth.</dt>
  796. </dl>
  797. </div>
  798. <h3 class="name name-method" id="getClearStencil" translate="no">.<a href="#getClearStencil">getClearStencil</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  799. <div class="method">
  800. <div class="description">
  801. <p>Returns the clear stencil.</p>
  802. </div>
  803. <dl class="details">
  804. <dt class="tag-returns"><strong>Returns:</strong> The clear stencil.</dt>
  805. </dl>
  806. </div>
  807. <h3 class="name name-method" id="getColorBufferType" translate="no">.<a href="#getColorBufferType">getColorBufferType</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  808. <div class="method">
  809. <div class="description">
  810. <p>Returns the color buffer type.</p>
  811. </div>
  812. <dl class="details">
  813. <dt class="tag-returns"><strong>Returns:</strong> The color buffer type.</dt>
  814. </dl>
  815. </div>
  816. <h3 class="name name-method" id="getContext" translate="no">.<a href="#getContext">getContext</a><span class="signature">()</span><span class="type-signature"> : GPUCanvasContext | WebGL2RenderingContext</span> </h3>
  817. <div class="method">
  818. <div class="description">
  819. <p>Returns the rendering context.</p>
  820. </div>
  821. <dl class="details">
  822. <dt class="tag-returns"><strong>Returns:</strong> The rendering context.</dt>
  823. </dl>
  824. </div>
  825. <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>
  826. <div class="method">
  827. <div class="description">
  828. <p>Returns the drawing buffer size in physical pixels. This method honors the pixel ratio.</p>
  829. </div>
  830. <table class="params">
  831. <tbody>
  832. <tr>
  833. <td class="name">
  834. <strong>target</strong>
  835. </td>
  836. <td class="description last">
  837. <p>The method writes the result in this target object.</p>
  838. </td>
  839. </tr>
  840. </tbody>
  841. </table>
  842. <dl class="details">
  843. <dt class="tag-returns"><strong>Returns:</strong> The drawing buffer size.</dt>
  844. </dl>
  845. </div>
  846. <h3 class="name name-method" id="getMRT" translate="no">.<a href="#getMRT">getMRT</a><span class="signature">()</span><span class="type-signature"> : <a href="MRTNode.html">MRTNode</a></span> </h3>
  847. <div class="method">
  848. <div class="description">
  849. <p>Returns the MRT configuration.</p>
  850. </div>
  851. <dl class="details">
  852. <dt class="tag-returns"><strong>Returns:</strong> The MRT configuration.</dt>
  853. </dl>
  854. </div>
  855. <h3 class="name name-method" id="getMaxAnisotropy" translate="no">.<a href="#getMaxAnisotropy">getMaxAnisotropy</a><span class="signature">()</span><span class="type-signature"> : number</span> </h3>
  856. <div class="method">
  857. <div class="description">
  858. <p>Returns the maximum available anisotropy for texture filtering.</p>
  859. </div>
  860. <dl class="details">
  861. <dt class="tag-returns"><strong>Returns:</strong> The maximum available anisotropy.</dt>
  862. </dl>
  863. </div>
  864. <h3 class="name name-method" id="getOutputRenderTarget" translate="no">.<a href="#getOutputRenderTarget">getOutputRenderTarget</a><span class="signature">()</span><span class="type-signature"> : <a href="RenderTarget.html">RenderTarget</a></span> </h3>
  865. <div class="method">
  866. <div class="description">
  867. <p>Returns the current output target.</p>
  868. </div>
  869. <dl class="details">
  870. <dt class="tag-returns"><strong>Returns:</strong> The current output render target. Returns <code>null</code> if no output target is set.</dt>
  871. </dl>
  872. </div>
  873. <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>
  874. <div class="method">
  875. <div class="description">
  876. <p>Returns the pixel ratio.</p>
  877. </div>
  878. <dl class="details">
  879. <dt class="tag-returns"><strong>Returns:</strong> The pixel ratio.</dt>
  880. </dl>
  881. </div>
  882. <h3 class="name name-method" id="getRenderObjectFunction" translate="no">.<a href="#getRenderObjectFunction">getRenderObjectFunction</a><span class="signature">()</span><span class="type-signature"> : function</span> </h3>
  883. <div class="method">
  884. <div class="description">
  885. <p>Returns the current render object function.</p>
  886. </div>
  887. <dl class="details">
  888. <dt class="tag-returns"><strong>Returns:</strong> The current render object function. Returns <code>null</code> if no function is set.</dt>
  889. </dl>
  890. </div>
  891. <h3 class="name name-method" id="getRenderTarget" translate="no">.<a href="#getRenderTarget">getRenderTarget</a><span class="signature">()</span><span class="type-signature"> : <a href="RenderTarget.html">RenderTarget</a></span> </h3>
  892. <div class="method">
  893. <div class="description">
  894. <p>Returns the current render target.</p>
  895. </div>
  896. <dl class="details">
  897. <dt class="tag-returns"><strong>Returns:</strong> The render target. Returns <code>null</code> if no render target is set.</dt>
  898. </dl>
  899. </div>
  900. <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>
  901. <div class="method">
  902. <div class="description">
  903. <p>Returns the scissor rectangle.</p>
  904. </div>
  905. <table class="params">
  906. <tbody>
  907. <tr>
  908. <td class="name">
  909. <strong>target</strong>
  910. </td>
  911. <td class="description last">
  912. <p>The method writes the result in this target object.</p>
  913. </td>
  914. </tr>
  915. </tbody>
  916. </table>
  917. <dl class="details">
  918. <dt class="tag-returns"><strong>Returns:</strong> The scissor rectangle.</dt>
  919. </dl>
  920. </div>
  921. <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>
  922. <div class="method">
  923. <div class="description">
  924. <p>Returns the scissor test value.</p>
  925. </div>
  926. <dl class="details">
  927. <dt class="tag-returns"><strong>Returns:</strong> Whether the scissor test should be enabled or not.</dt>
  928. </dl>
  929. </div>
  930. <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>
  931. <div class="method">
  932. <div class="description">
  933. <p>Returns the renderer's size in logical pixels. This method does not honor the pixel ratio.</p>
  934. </div>
  935. <table class="params">
  936. <tbody>
  937. <tr>
  938. <td class="name">
  939. <strong>target</strong>
  940. </td>
  941. <td class="description last">
  942. <p>The method writes the result in this target object.</p>
  943. </td>
  944. </tr>
  945. </tbody>
  946. </table>
  947. <dl class="details">
  948. <dt class="tag-returns"><strong>Returns:</strong> The renderer's size in logical pixels.</dt>
  949. </dl>
  950. </div>
  951. <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>
  952. <div class="method">
  953. <div class="description">
  954. <p>Returns the viewport definition.</p>
  955. </div>
  956. <table class="params">
  957. <tbody>
  958. <tr>
  959. <td class="name">
  960. <strong>target</strong>
  961. </td>
  962. <td class="description last">
  963. <p>The method writes the result in this target object.</p>
  964. </td>
  965. </tr>
  966. </tbody>
  967. </table>
  968. <dl class="details">
  969. <dt class="tag-returns"><strong>Returns:</strong> The viewport definition.</dt>
  970. </dl>
  971. </div>
  972. <h3 class="name name-method" id="hasFeature" translate="no">.<a href="#hasFeature">hasFeature</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  973. <div class="method">
  974. <div class="description">
  975. <p>Checks if the given feature is supported by the selected backend. If the
  976. renderer has not been initialized, this method always returns <code>false</code>.</p>
  977. </div>
  978. <table class="params">
  979. <tbody>
  980. <tr>
  981. <td class="name">
  982. <strong>name</strong>
  983. </td>
  984. <td class="description last">
  985. <p>The feature's name.</p>
  986. </td>
  987. </tr>
  988. </tbody>
  989. </table>
  990. <dl class="details">
  991. <dt class="tag-returns"><strong>Returns:</strong> Whether the feature is supported or not.</dt>
  992. </dl>
  993. </div>
  994. <h3 class="name name-method" id="hasFeatureAsync" translate="no">.<a href="#hasFeatureAsync">hasFeatureAsync</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : Promise.&lt;boolean></span> <span class="type-signature">(async) </span></h3>
  995. <div class="method">
  996. <div class="description">
  997. <p>Checks if the given feature is supported by the selected backend.</p>
  998. </div>
  999. <table class="params">
  1000. <tbody>
  1001. <tr>
  1002. <td class="name">
  1003. <strong>name</strong>
  1004. </td>
  1005. <td class="description last">
  1006. <p>The feature's name.</p>
  1007. </td>
  1008. </tr>
  1009. </tbody>
  1010. </table>
  1011. <dl class="details">
  1012. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  1013. </dl>
  1014. <dl class="details">
  1015. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves with a bool that indicates whether the feature is supported or not.</dt>
  1016. </dl>
  1017. </div>
  1018. <h3 class="name name-method" id="hasInitialized" translate="no">.<a href="#hasInitialized">hasInitialized</a><span class="signature">()</span><span class="type-signature"> : boolean</span> </h3>
  1019. <div class="method">
  1020. <div class="description">
  1021. <p>Returns <code>true</code> when the renderer has been initialized.</p>
  1022. </div>
  1023. <dl class="details">
  1024. <dt class="tag-returns"><strong>Returns:</strong> Whether the renderer has been initialized or not.</dt>
  1025. </dl>
  1026. </div>
  1027. <h3 class="name name-method" id="init" translate="no">.<a href="#init">init</a><span class="signature">()</span><span class="type-signature"> : Promise.&lt;this></span> <span class="type-signature">(async) </span></h3>
  1028. <div class="method">
  1029. <div class="description">
  1030. <p>Initializes the renderer so it is ready for usage.</p>
  1031. </div>
  1032. <dl class="details">
  1033. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the renderer has been initialized.</dt>
  1034. </dl>
  1035. </div>
  1036. <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>
  1037. <div class="method">
  1038. <div class="description">
  1039. <p>Initializes the given texture. Useful for preloading a texture rather than waiting until first render
  1040. (which can cause noticeable lags due to decode and GPU upload overhead).</p>
  1041. <p>This method can only be used if the renderer has been initialized.</p>
  1042. </div>
  1043. <table class="params">
  1044. <tbody>
  1045. <tr>
  1046. <td class="name">
  1047. <strong>texture</strong>
  1048. </td>
  1049. <td class="description last">
  1050. <p>The texture.</p>
  1051. </td>
  1052. </tr>
  1053. </tbody>
  1054. </table>
  1055. </div>
  1056. <h3 class="name name-method" id="initTextureAsync" translate="no">.<a href="#initTextureAsync">initTextureAsync</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  1057. <div class="method">
  1058. <div class="description">
  1059. <p>Initializes the given textures. Useful for preloading a texture rather than waiting until first render
  1060. (which can cause noticeable lags due to decode and GPU upload overhead).</p>
  1061. </div>
  1062. <table class="params">
  1063. <tbody>
  1064. <tr>
  1065. <td class="name">
  1066. <strong>texture</strong>
  1067. </td>
  1068. <td class="description last">
  1069. <p>The texture.</p>
  1070. </td>
  1071. </tr>
  1072. </tbody>
  1073. </table>
  1074. <dl class="details">
  1075. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  1076. </dl>
  1077. <dl class="details">
  1078. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the texture has been initialized.</dt>
  1079. </dl>
  1080. </div>
  1081. <h3 class="name name-method" id="isOccluded" translate="no">.<a href="#isOccluded">isOccluded</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : boolean</span> </h3>
  1082. <div class="method">
  1083. <div class="description">
  1084. <p>This method performs an occlusion query for the given 3D object.
  1085. It returns <code>true</code> if the given 3D object is fully occluded by other
  1086. 3D objects in the scene.</p>
  1087. </div>
  1088. <table class="params">
  1089. <tbody>
  1090. <tr>
  1091. <td class="name">
  1092. <strong>object</strong>
  1093. </td>
  1094. <td class="description last">
  1095. <p>The 3D object to test.</p>
  1096. </td>
  1097. </tr>
  1098. </tbody>
  1099. </table>
  1100. <dl class="details">
  1101. <dt class="tag-returns"><strong>Returns:</strong> Whether the 3D object is fully occluded or not.</dt>
  1102. </dl>
  1103. </div>
  1104. <h3 class="name name-method" id="readRenderTargetPixelsAsync" translate="no">.<a href="#readRenderTargetPixelsAsync">readRenderTargetPixelsAsync</a><span class="signature">( renderTarget : <span class="param-type"><a href="RenderTarget.html">RenderTarget</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>, textureIndex : <span class="param-type">number</span>, faceIndex : <span class="param-type">number</span> )</span><span class="type-signature"> : Promise.&lt;TypedArray></span> <span class="type-signature">(async) </span></h3>
  1105. <div class="method">
  1106. <div class="description">
  1107. <p>Reads pixel data from the given render target.</p>
  1108. </div>
  1109. <table class="params">
  1110. <tbody>
  1111. <tr>
  1112. <td class="name">
  1113. <strong>renderTarget</strong>
  1114. </td>
  1115. <td class="description last">
  1116. <p>The render target to read from.</p>
  1117. </td>
  1118. </tr>
  1119. <tr>
  1120. <td class="name">
  1121. <strong>x</strong>
  1122. </td>
  1123. <td class="description last">
  1124. <p>The <code>x</code> coordinate of the copy region's origin.</p>
  1125. </td>
  1126. </tr>
  1127. <tr>
  1128. <td class="name">
  1129. <strong>y</strong>
  1130. </td>
  1131. <td class="description last">
  1132. <p>The <code>y</code> coordinate of the copy region's origin.</p>
  1133. </td>
  1134. </tr>
  1135. <tr>
  1136. <td class="name">
  1137. <strong>width</strong>
  1138. </td>
  1139. <td class="description last">
  1140. <p>The width of the copy region.</p>
  1141. </td>
  1142. </tr>
  1143. <tr>
  1144. <td class="name">
  1145. <strong>height</strong>
  1146. </td>
  1147. <td class="description last">
  1148. <p>The height of the copy region.</p>
  1149. </td>
  1150. </tr>
  1151. <tr>
  1152. <td class="name">
  1153. <strong>textureIndex</strong>
  1154. </td>
  1155. <td class="description last">
  1156. <p>The texture index of a MRT render target.</p>
  1157. <p>Default is <code>0</code>.</p>
  1158. </td>
  1159. </tr>
  1160. <tr>
  1161. <td class="name">
  1162. <strong>faceIndex</strong>
  1163. </td>
  1164. <td class="description last">
  1165. <p>The active cube face index.</p>
  1166. <p>Default is <code>0</code>.</p>
  1167. </td>
  1168. </tr>
  1169. </tbody>
  1170. </table>
  1171. <dl class="details">
  1172. <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>
  1173. </dl>
  1174. </div>
  1175. <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>
  1176. <div class="method">
  1177. <div class="description">
  1178. <p>Renders the scene or 3D object with the given camera. This method can only be called
  1179. if the renderer has been initialized. When using <code>render()</code> inside an animation loop,
  1180. it's guaranteed the renderer will be initialized. The animation loop must be defined
  1181. with <a href="Renderer.html#setAnimationLoop">Renderer#setAnimationLoop</a> though.</p>
  1182. <p>For all other use cases (like when using on-demand rendering), you must call
  1183. <a href="Renderer.html#init">Renderer#init</a> before rendering.</p>
  1184. <p>The target of the method is the default framebuffer (meaning the canvas)
  1185. or alternatively a render target when specified via <code>setRenderTarget()</code>.</p>
  1186. </div>
  1187. <table class="params">
  1188. <tbody>
  1189. <tr>
  1190. <td class="name">
  1191. <strong>scene</strong>
  1192. </td>
  1193. <td class="description last">
  1194. <p>The scene or 3D object to render.</p>
  1195. </td>
  1196. </tr>
  1197. <tr>
  1198. <td class="name">
  1199. <strong>camera</strong>
  1200. </td>
  1201. <td class="description last">
  1202. <p>The camera to render the scene with.</p>
  1203. </td>
  1204. </tr>
  1205. </tbody>
  1206. </table>
  1207. </div>
  1208. <h3 class="name name-method" id="renderAsync" translate="no">.<a href="#renderAsync">renderAsync</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><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  1209. <div class="method">
  1210. <div class="description">
  1211. <p>Renders the scene in an async fashion.</p>
  1212. </div>
  1213. <table class="params">
  1214. <tbody>
  1215. <tr>
  1216. <td class="name">
  1217. <strong>scene</strong>
  1218. </td>
  1219. <td class="description last">
  1220. <p>The scene or 3D object to render.</p>
  1221. </td>
  1222. </tr>
  1223. <tr>
  1224. <td class="name">
  1225. <strong>camera</strong>
  1226. </td>
  1227. <td class="description last">
  1228. <p>The camera.</p>
  1229. </td>
  1230. </tr>
  1231. </tbody>
  1232. </table>
  1233. <dl class="details">
  1234. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  1235. </dl>
  1236. <dl class="details">
  1237. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the render has been finished.</dt>
  1238. </dl>
  1239. </div>
  1240. <h3 class="name name-method" id="renderObject" translate="no">.<a href="#renderObject">renderObject</a><span class="signature">( object : <span class="param-type"><a href="Object3D.html">Object3D</a></span>, scene : <span class="param-type"><a href="Scene.html">Scene</a></span>, camera : <span class="param-type"><a href="Camera.html">Camera</a></span>, geometry : <span class="param-type"><a href="BufferGeometry.html">BufferGeometry</a></span>, material : <span class="param-type"><a href="Material.html">Material</a></span>, group : <span class="param-type">Object</span>, lightsNode : <span class="param-type"><a href="LightsNode.html">LightsNode</a></span>, clippingContext : <span class="param-type"><a href="ClippingContext.html">ClippingContext</a></span>, passId : <span class="param-type">string</span> )</span> </h3>
  1241. <div class="method">
  1242. <div class="description">
  1243. <p>This method represents the default render object function that manages the render lifecycle
  1244. of the object.</p>
  1245. </div>
  1246. <table class="params">
  1247. <tbody>
  1248. <tr>
  1249. <td class="name">
  1250. <strong>object</strong>
  1251. </td>
  1252. <td class="description last">
  1253. <p>The 3D object.</p>
  1254. </td>
  1255. </tr>
  1256. <tr>
  1257. <td class="name">
  1258. <strong>scene</strong>
  1259. </td>
  1260. <td class="description last">
  1261. <p>The scene the 3D object belongs to.</p>
  1262. </td>
  1263. </tr>
  1264. <tr>
  1265. <td class="name">
  1266. <strong>camera</strong>
  1267. </td>
  1268. <td class="description last">
  1269. <p>The camera the object should be rendered with.</p>
  1270. </td>
  1271. </tr>
  1272. <tr>
  1273. <td class="name">
  1274. <strong>geometry</strong>
  1275. </td>
  1276. <td class="description last">
  1277. <p>The object's geometry.</p>
  1278. </td>
  1279. </tr>
  1280. <tr>
  1281. <td class="name">
  1282. <strong>material</strong>
  1283. </td>
  1284. <td class="description last">
  1285. <p>The object's material.</p>
  1286. </td>
  1287. </tr>
  1288. <tr>
  1289. <td class="name">
  1290. <strong>group</strong>
  1291. </td>
  1292. <td class="description last">
  1293. <p>Only relevant for objects using multiple materials. This represents a group entry from the respective <code>BufferGeometry</code>.</p>
  1294. </td>
  1295. </tr>
  1296. <tr>
  1297. <td class="name">
  1298. <strong>lightsNode</strong>
  1299. </td>
  1300. <td class="description last">
  1301. <p>The current lights node.</p>
  1302. </td>
  1303. </tr>
  1304. <tr>
  1305. <td class="name">
  1306. <strong>clippingContext</strong>
  1307. </td>
  1308. <td class="description last">
  1309. <p>The clipping context.</p>
  1310. <p>Default is <code>null</code>.</p>
  1311. </td>
  1312. </tr>
  1313. <tr>
  1314. <td class="name">
  1315. <strong>passId</strong>
  1316. </td>
  1317. <td class="description last">
  1318. <p>An optional ID for identifying the pass.</p>
  1319. <p>Default is <code>null</code>.</p>
  1320. </td>
  1321. </tr>
  1322. </tbody>
  1323. </table>
  1324. </div>
  1325. <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><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  1326. <div class="method">
  1327. <div class="description">
  1328. <p>Applications are advised to always define the animation loop
  1329. with this method and not manually with <code>requestAnimationFrame()</code>
  1330. for best compatibility.</p>
  1331. </div>
  1332. <table class="params">
  1333. <tbody>
  1334. <tr>
  1335. <td class="name">
  1336. <strong>callback</strong>
  1337. </td>
  1338. <td class="description last">
  1339. <p>The application's animation loop.</p>
  1340. </td>
  1341. </tr>
  1342. </tbody>
  1343. </table>
  1344. <dl class="details">
  1345. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the set has been executed.</dt>
  1346. </dl>
  1347. </div>
  1348. <h3 class="name name-method" id="setCanvasTarget" translate="no">.<a href="#setCanvasTarget">setCanvasTarget</a><span class="signature">( canvasTarget : <span class="param-type"><a href="CanvasTarget.html">CanvasTarget</a></span> )</span> </h3>
  1349. <div class="method">
  1350. <div class="description">
  1351. <p>Sets the canvas target. The canvas target manages the HTML canvas
  1352. or the offscreen canvas the renderer draws into.</p>
  1353. </div>
  1354. <table class="params">
  1355. <tbody>
  1356. <tr>
  1357. <td class="name">
  1358. <strong>canvasTarget</strong>
  1359. </td>
  1360. <td class="description last">
  1361. <p>The canvas target.</p>
  1362. </td>
  1363. </tr>
  1364. </tbody>
  1365. </table>
  1366. </div>
  1367. <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>
  1368. <div class="method">
  1369. <div class="description">
  1370. <p>Defines the clear alpha.</p>
  1371. </div>
  1372. <table class="params">
  1373. <tbody>
  1374. <tr>
  1375. <td class="name">
  1376. <strong>alpha</strong>
  1377. </td>
  1378. <td class="description last">
  1379. <p>The clear alpha.</p>
  1380. </td>
  1381. </tr>
  1382. </tbody>
  1383. </table>
  1384. </div>
  1385. <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>
  1386. <div class="method">
  1387. <div class="description">
  1388. <p>Defines the clear color and optionally the clear alpha.</p>
  1389. </div>
  1390. <table class="params">
  1391. <tbody>
  1392. <tr>
  1393. <td class="name">
  1394. <strong>color</strong>
  1395. </td>
  1396. <td class="description last">
  1397. <p>The clear color.</p>
  1398. </td>
  1399. </tr>
  1400. <tr>
  1401. <td class="name">
  1402. <strong>alpha</strong>
  1403. </td>
  1404. <td class="description last">
  1405. <p>The clear alpha.</p>
  1406. <p>Default is <code>1</code>.</p>
  1407. </td>
  1408. </tr>
  1409. </tbody>
  1410. </table>
  1411. </div>
  1412. <h3 class="name name-method" id="setClearDepth" translate="no">.<a href="#setClearDepth">setClearDepth</a><span class="signature">( depth : <span class="param-type">number</span> )</span> </h3>
  1413. <div class="method">
  1414. <div class="description">
  1415. <p>Defines the clear depth.</p>
  1416. </div>
  1417. <table class="params">
  1418. <tbody>
  1419. <tr>
  1420. <td class="name">
  1421. <strong>depth</strong>
  1422. </td>
  1423. <td class="description last">
  1424. <p>The clear depth.</p>
  1425. </td>
  1426. </tr>
  1427. </tbody>
  1428. </table>
  1429. </div>
  1430. <h3 class="name name-method" id="setClearStencil" translate="no">.<a href="#setClearStencil">setClearStencil</a><span class="signature">( stencil : <span class="param-type">number</span> )</span> </h3>
  1431. <div class="method">
  1432. <div class="description">
  1433. <p>Defines the clear stencil.</p>
  1434. </div>
  1435. <table class="params">
  1436. <tbody>
  1437. <tr>
  1438. <td class="name">
  1439. <strong>stencil</strong>
  1440. </td>
  1441. <td class="description last">
  1442. <p>The clear stencil.</p>
  1443. </td>
  1444. </tr>
  1445. </tbody>
  1446. </table>
  1447. </div>
  1448. <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>
  1449. <div class="method">
  1450. <div class="description">
  1451. <p>This method allows to define the drawing buffer size by specifying
  1452. width, height and pixel ratio all at once. The size of the drawing
  1453. buffer is computed with this formula:</p>
  1454. <pre><code class="language-js">size.x = width * pixelRatio;
  1455. size.y = height * pixelRatio;
  1456. </code></pre>
  1457. </div>
  1458. <table class="params">
  1459. <tbody>
  1460. <tr>
  1461. <td class="name">
  1462. <strong>width</strong>
  1463. </td>
  1464. <td class="description last">
  1465. <p>The width in logical pixels.</p>
  1466. </td>
  1467. </tr>
  1468. <tr>
  1469. <td class="name">
  1470. <strong>height</strong>
  1471. </td>
  1472. <td class="description last">
  1473. <p>The height in logical pixels.</p>
  1474. </td>
  1475. </tr>
  1476. <tr>
  1477. <td class="name">
  1478. <strong>pixelRatio</strong>
  1479. </td>
  1480. <td class="description last">
  1481. <p>The pixel ratio.</p>
  1482. </td>
  1483. </tr>
  1484. </tbody>
  1485. </table>
  1486. </div>
  1487. <h3 class="name name-method" id="setMRT" translate="no">.<a href="#setMRT">setMRT</a><span class="signature">( mrt : <span class="param-type"><a href="MRTNode.html">MRTNode</a></span> )</span><span class="type-signature"> : <a href="Renderer.html">Renderer</a></span> </h3>
  1488. <div class="method">
  1489. <div class="description">
  1490. <p>Sets the given MRT configuration.</p>
  1491. </div>
  1492. <table class="params">
  1493. <tbody>
  1494. <tr>
  1495. <td class="name">
  1496. <strong>mrt</strong>
  1497. </td>
  1498. <td class="description last">
  1499. <p>The MRT node to set.</p>
  1500. </td>
  1501. </tr>
  1502. </tbody>
  1503. </table>
  1504. <dl class="details">
  1505. <dt class="tag-returns"><strong>Returns:</strong> A reference to this renderer.</dt>
  1506. </dl>
  1507. </div>
  1508. <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>
  1509. <div class="method">
  1510. <div class="description">
  1511. <p>Defines a manual sort function for the opaque render list.
  1512. Pass <code>null</code> to use the default sort.</p>
  1513. </div>
  1514. <table class="params">
  1515. <tbody>
  1516. <tr>
  1517. <td class="name">
  1518. <strong>method</strong>
  1519. </td>
  1520. <td class="description last">
  1521. <p>The sort function.</p>
  1522. </td>
  1523. </tr>
  1524. </tbody>
  1525. </table>
  1526. </div>
  1527. <h3 class="name name-method" id="setOutputRenderTarget" translate="no">.<a href="#setOutputRenderTarget">setOutputRenderTarget</a><span class="signature">( renderTarget : <span class="param-type">Object</span> )</span> </h3>
  1528. <div class="method">
  1529. <div class="description">
  1530. <p>Sets the output render target for the renderer.</p>
  1531. </div>
  1532. <table class="params">
  1533. <tbody>
  1534. <tr>
  1535. <td class="name">
  1536. <strong>renderTarget</strong>
  1537. </td>
  1538. <td class="description last">
  1539. <p>The render target to set as the output target.</p>
  1540. </td>
  1541. </tr>
  1542. </tbody>
  1543. </table>
  1544. </div>
  1545. <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>
  1546. <div class="method">
  1547. <div class="description">
  1548. <p>Sets the given pixel ratio and resizes the canvas if necessary.</p>
  1549. </div>
  1550. <table class="params">
  1551. <tbody>
  1552. <tr>
  1553. <td class="name">
  1554. <strong>value</strong>
  1555. </td>
  1556. <td class="description last">
  1557. <p>The pixel ratio.</p>
  1558. <p>Default is <code>1</code>.</p>
  1559. </td>
  1560. </tr>
  1561. </tbody>
  1562. </table>
  1563. </div>
  1564. <h3 class="name name-method" id="setRenderObjectFunction" translate="no">.<a href="#setRenderObjectFunction">setRenderObjectFunction</a><span class="signature">( renderObjectFunction : <span class="param-type"><a href="global.html#renderObjectFunction">renderObjectFunction</a></span> )</span> </h3>
  1565. <div class="method">
  1566. <div class="description">
  1567. <p>Sets the given render object function. Calling this method overwrites the default implementation
  1568. which is <a href="Renderer.html#renderObject">Renderer#renderObject</a>. Defining a custom function can be useful
  1569. if you want to modify the way objects are rendered. For example you can define things like &quot;every
  1570. object that has material of a certain type should perform a pre-pass with a special overwrite material&quot;.
  1571. The custom function must always call <code>renderObject()</code> in its implementation.</p>
  1572. <p>Use <code>null</code> as the first argument to reset the state.</p>
  1573. </div>
  1574. <table class="params">
  1575. <tbody>
  1576. <tr>
  1577. <td class="name">
  1578. <strong>renderObjectFunction</strong>
  1579. </td>
  1580. <td class="description last">
  1581. <p>The render object function.</p>
  1582. </td>
  1583. </tr>
  1584. </tbody>
  1585. </table>
  1586. </div>
  1587. <h3 class="name name-method" id="setRenderTarget" translate="no">.<a href="#setRenderTarget">setRenderTarget</a><span class="signature">( renderTarget : <span class="param-type"><a href="RenderTarget.html">RenderTarget</a></span>, activeCubeFace : <span class="param-type">number</span>, activeMipmapLevel : <span class="param-type">number</span> )</span> </h3>
  1588. <div class="method">
  1589. <div class="description">
  1590. <p>Sets the given render target. Calling this method means the renderer does not
  1591. target the default framebuffer (meaning the canvas) anymore but a custom framebuffer.
  1592. Use <code>null</code> as the first argument to reset the state.</p>
  1593. </div>
  1594. <table class="params">
  1595. <tbody>
  1596. <tr>
  1597. <td class="name">
  1598. <strong>renderTarget</strong>
  1599. </td>
  1600. <td class="description last">
  1601. <p>The render target to set.</p>
  1602. </td>
  1603. </tr>
  1604. <tr>
  1605. <td class="name">
  1606. <strong>activeCubeFace</strong>
  1607. </td>
  1608. <td class="description last">
  1609. <p>The active cube face.</p>
  1610. <p>Default is <code>0</code>.</p>
  1611. </td>
  1612. </tr>
  1613. <tr>
  1614. <td class="name">
  1615. <strong>activeMipmapLevel</strong>
  1616. </td>
  1617. <td class="description last">
  1618. <p>The active mipmap level.</p>
  1619. <p>Default is <code>0</code>.</p>
  1620. </td>
  1621. </tr>
  1622. </tbody>
  1623. </table>
  1624. </div>
  1625. <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>
  1626. <div class="method">
  1627. <div class="description">
  1628. <p>Defines the scissor rectangle.</p>
  1629. </div>
  1630. <table class="params">
  1631. <tbody>
  1632. <tr>
  1633. <td class="name">
  1634. <strong>x</strong>
  1635. </td>
  1636. <td class="description last">
  1637. <p>The horizontal coordinate for the lower left corner of the box in logical pixel unit.
  1638. Instead of passing four arguments, the method also works with a single four-dimensional vector.</p>
  1639. </td>
  1640. </tr>
  1641. <tr>
  1642. <td class="name">
  1643. <strong>y</strong>
  1644. </td>
  1645. <td class="description last">
  1646. <p>The vertical coordinate for the lower left corner of the box in logical pixel unit.</p>
  1647. </td>
  1648. </tr>
  1649. <tr>
  1650. <td class="name">
  1651. <strong>width</strong>
  1652. </td>
  1653. <td class="description last">
  1654. <p>The width of the scissor box in logical pixel unit.</p>
  1655. </td>
  1656. </tr>
  1657. <tr>
  1658. <td class="name">
  1659. <strong>height</strong>
  1660. </td>
  1661. <td class="description last">
  1662. <p>The height of the scissor box in logical pixel unit.</p>
  1663. </td>
  1664. </tr>
  1665. </tbody>
  1666. </table>
  1667. </div>
  1668. <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>
  1669. <div class="method">
  1670. <div class="description">
  1671. <p>Defines the scissor test.</p>
  1672. </div>
  1673. <table class="params">
  1674. <tbody>
  1675. <tr>
  1676. <td class="name">
  1677. <strong>boolean</strong>
  1678. </td>
  1679. <td class="description last">
  1680. <p>Whether the scissor test should be enabled or not.</p>
  1681. </td>
  1682. </tr>
  1683. </tbody>
  1684. </table>
  1685. </div>
  1686. <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>
  1687. <div class="method">
  1688. <div class="description">
  1689. <p>Sets the size of the renderer.</p>
  1690. </div>
  1691. <table class="params">
  1692. <tbody>
  1693. <tr>
  1694. <td class="name">
  1695. <strong>width</strong>
  1696. </td>
  1697. <td class="description last">
  1698. <p>The width in logical pixels.</p>
  1699. </td>
  1700. </tr>
  1701. <tr>
  1702. <td class="name">
  1703. <strong>height</strong>
  1704. </td>
  1705. <td class="description last">
  1706. <p>The height in logical pixels.</p>
  1707. </td>
  1708. </tr>
  1709. <tr>
  1710. <td class="name">
  1711. <strong>updateStyle</strong>
  1712. </td>
  1713. <td class="description last">
  1714. <p>Whether to update the <code>style</code> attribute of the canvas or not.</p>
  1715. <p>Default is <code>true</code>.</p>
  1716. </td>
  1717. </tr>
  1718. </tbody>
  1719. </table>
  1720. </div>
  1721. <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>
  1722. <div class="method">
  1723. <div class="description">
  1724. <p>Defines a manual sort function for the transparent render list.
  1725. Pass <code>null</code> to use the default sort.</p>
  1726. </div>
  1727. <table class="params">
  1728. <tbody>
  1729. <tr>
  1730. <td class="name">
  1731. <strong>method</strong>
  1732. </td>
  1733. <td class="description last">
  1734. <p>The sort function.</p>
  1735. </td>
  1736. </tr>
  1737. </tbody>
  1738. </table>
  1739. </div>
  1740. <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>, minDepth : <span class="param-type">number</span>, maxDepth : <span class="param-type">number</span> )</span> </h3>
  1741. <div class="method">
  1742. <div class="description">
  1743. <p>Defines the viewport.</p>
  1744. </div>
  1745. <table class="params">
  1746. <tbody>
  1747. <tr>
  1748. <td class="name">
  1749. <strong>x</strong>
  1750. </td>
  1751. <td class="description last">
  1752. <p>The horizontal coordinate for the lower left corner of the viewport origin in logical pixel unit.</p>
  1753. </td>
  1754. </tr>
  1755. <tr>
  1756. <td class="name">
  1757. <strong>y</strong>
  1758. </td>
  1759. <td class="description last">
  1760. <p>The vertical coordinate for the lower left corner of the viewport origin in logical pixel unit.</p>
  1761. </td>
  1762. </tr>
  1763. <tr>
  1764. <td class="name">
  1765. <strong>width</strong>
  1766. </td>
  1767. <td class="description last">
  1768. <p>The width of the viewport in logical pixel unit.</p>
  1769. </td>
  1770. </tr>
  1771. <tr>
  1772. <td class="name">
  1773. <strong>height</strong>
  1774. </td>
  1775. <td class="description last">
  1776. <p>The height of the viewport in logical pixel unit.</p>
  1777. </td>
  1778. </tr>
  1779. <tr>
  1780. <td class="name">
  1781. <strong>minDepth</strong>
  1782. </td>
  1783. <td class="description last">
  1784. <p>The minimum depth value of the viewport. WebGPU only.</p>
  1785. <p>Default is <code>0</code>.</p>
  1786. </td>
  1787. </tr>
  1788. <tr>
  1789. <td class="name">
  1790. <strong>maxDepth</strong>
  1791. </td>
  1792. <td class="description last">
  1793. <p>The maximum depth value of the viewport. WebGPU only.</p>
  1794. <p>Default is <code>1</code>.</p>
  1795. </td>
  1796. </tr>
  1797. </tbody>
  1798. </table>
  1799. </div>
  1800. <h3 class="name name-method" id="waitForGPU" translate="no">.<a href="#waitForGPU">waitForGPU</a><span class="signature">()</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  1801. <div class="method">
  1802. <div class="description">
  1803. <p>Can be used to synchronize CPU operations with GPU tasks. So when this method is called,
  1804. the CPU waits for the GPU to complete its operation (e.g. a compute task).</p>
  1805. </div>
  1806. <dl class="details">
  1807. <dt class="important tag-deprecated"><strong>Deprecated:</strong> Yes</dt>
  1808. </dl>
  1809. <dl class="details">
  1810. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when synchronization has been finished.</dt>
  1811. </dl>
  1812. </div>
  1813. <h2 class="subsection-title">Type Definitions</h2>
  1814. <div class="member">
  1815. <h3 class="name" id="~Options" translate="no">.<a href="#~Options">Options</a> </h3>
  1816. <div class="description">
  1817. <p>Renderer options.</p>
  1818. </div>
  1819. <table class="props">
  1820. <tbody>
  1821. <tr>
  1822. <td class="name">
  1823. <strong>logarithmicDepthBuffer</strong>
  1824. <br>
  1825. <span class="param-type">boolean</span>
  1826. </td>
  1827. <td class="description last">
  1828. <p>Whether logarithmic depth buffer is enabled or not.</p>
  1829. <p>Default is <code>false</code>.</p>
  1830. </td>
  1831. </tr>
  1832. <tr>
  1833. <td class="name">
  1834. <strong>alpha</strong>
  1835. <br>
  1836. <span class="param-type">boolean</span>
  1837. </td>
  1838. <td class="description last">
  1839. <p>Whether the default framebuffer (which represents the final contents of the canvas) should be transparent or opaque.</p>
  1840. <p>Default is <code>true</code>.</p>
  1841. </td>
  1842. </tr>
  1843. <tr>
  1844. <td class="name">
  1845. <strong>depth</strong>
  1846. <br>
  1847. <span class="param-type">boolean</span>
  1848. </td>
  1849. <td class="description last">
  1850. <p>Whether the default framebuffer should have a depth buffer or not.</p>
  1851. <p>Default is <code>true</code>.</p>
  1852. </td>
  1853. </tr>
  1854. <tr>
  1855. <td class="name">
  1856. <strong>stencil</strong>
  1857. <br>
  1858. <span class="param-type">boolean</span>
  1859. </td>
  1860. <td class="description last">
  1861. <p>Whether the default framebuffer should have a stencil buffer or not.</p>
  1862. <p>Default is <code>false</code>.</p>
  1863. </td>
  1864. </tr>
  1865. <tr>
  1866. <td class="name">
  1867. <strong>antialias</strong>
  1868. <br>
  1869. <span class="param-type">boolean</span>
  1870. </td>
  1871. <td class="description last">
  1872. <p>Whether MSAA as the default anti-aliasing should be enabled or not.</p>
  1873. <p>Default is <code>false</code>.</p>
  1874. </td>
  1875. </tr>
  1876. <tr>
  1877. <td class="name">
  1878. <strong>samples</strong>
  1879. <br>
  1880. <span class="param-type">number</span>
  1881. </td>
  1882. <td class="description last">
  1883. <p>When <code>antialias</code> is <code>true</code>, <code>4</code> samples are used by default. This parameter can set to any other integer value than 0
  1884. to overwrite the default.</p>
  1885. <p>Default is <code>0</code>.</p>
  1886. </td>
  1887. </tr>
  1888. <tr>
  1889. <td class="name">
  1890. <strong>getFallback</strong>
  1891. <br>
  1892. <span class="param-type">function</span>
  1893. </td>
  1894. <td class="description last">
  1895. <p>This callback function can be used to provide a fallback backend, if the primary backend can't be targeted.</p>
  1896. <p>Default is <code>null</code>.</p>
  1897. </td>
  1898. </tr>
  1899. <tr>
  1900. <td class="name">
  1901. <strong>colorBufferType</strong>
  1902. <br>
  1903. <span class="param-type">number</span>
  1904. </td>
  1905. <td class="description last">
  1906. <p>Defines the type of color buffers. The default <code>HalfFloatType</code> is recommend for best
  1907. quality. To save memory and bandwidth, <code>UnsignedByteType</code> might be used. This will reduce rendering quality though.</p>
  1908. <p>Default is <code>HalfFloatType</code>.</p>
  1909. </td>
  1910. </tr>
  1911. <tr>
  1912. <td class="name">
  1913. <strong>multiview</strong>
  1914. <br>
  1915. <span class="param-type">boolean</span>
  1916. </td>
  1917. <td class="description last">
  1918. <p>If set to <code>true</code>, the renderer will use multiview during WebXR rendering if supported.</p>
  1919. <p>Default is <code>false</code>.</p>
  1920. </td>
  1921. </tr>
  1922. </tbody>
  1923. </table>
  1924. </div>
  1925. <h2 class="subsection-title">Source</h2>
  1926. <p>
  1927. <a href="https://github.com/mrdoob/three.js/blob/master/src/renderers/common/Renderer.js" translate="no" target="_blank" rel="noopener">src/renderers/common/Renderer.js</a>
  1928. </p>
  1929. </article>
  1930. </section>
  1931. <script src="../scripts/linenumber.js"></script>
  1932. <script src="../scripts/page.js"></script>
  1933. </body>
  1934. </html>
粤ICP备19079148号