Backend.html 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Backend - 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">Backend</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>Most of the rendering related logic is implemented in the
  16. <a href="Renderer.html">Renderer</a> module and related management components.
  17. Sometimes it is required though to execute commands which are
  18. specific to the current 3D backend (which is WebGPU or WebGL 2).
  19. This abstract base class defines an interface that encapsulates
  20. all backend-related logic. Derived classes for each backend must
  21. implement the interface.</p></div>
  22. </header>
  23. <article>
  24. <div class="container-overview">
  25. <h2>Constructor</h2>
  26. <h3 class="name name-method" id="Backend" translate="no">new <a href="#Backend">Backend</a><span class="signature">( parameters : <span class="param-type">Object</span> )</span> <span class="type-signature">(abstract) </span></h3>
  27. <div class="method">
  28. <div class="description">
  29. <p>Constructs a new backend.</p>
  30. </div>
  31. <table class="params">
  32. <tbody>
  33. <tr>
  34. <td class="name">
  35. <strong translate="no">parameters</strong>
  36. </td>
  37. <td class="description last">
  38. <p>An object holding parameters for the backend.</p>
  39. </td>
  40. </tr>
  41. </tbody>
  42. </table>
  43. </div>
  44. </div>
  45. <h2 class="subsection-title">Properties</h2>
  46. <div class="member">
  47. <h3 class="name" id="coordinateSystem" translate="no">.<a href="#coordinateSystem">coordinateSystem</a><span class="type-signature"> : number</span> <span class="type-signature">(abstract, readonly) </span></h3>
  48. <div class="description">
  49. <p>The coordinate system of the backend.</p>
  50. </div>
  51. </div>
  52. <div class="member">
  53. <h3 class="name" id="data" translate="no">.<a href="#data">data</a><span class="type-signature"> : WeakMap.&lt;Object, Object></span> </h3>
  54. <div class="description">
  55. <p>This weak map holds backend-specific data of objects
  56. like textures, attributes or render targets.</p>
  57. </div>
  58. </div>
  59. <div class="member">
  60. <h3 class="name" id="domElement" translate="no">.<a href="#domElement">domElement</a><span class="type-signature"> : HTMLCanvasElement | OffscreenCanvas</span> </h3>
  61. <div class="description">
  62. <p>A reference to the canvas element the renderer is drawing to.</p>
  63. <p>Default is <code>null</code>.</p>
  64. </div>
  65. </div>
  66. <div class="member">
  67. <h3 class="name" id="hasTimestamp" translate="no">.<a href="#hasTimestamp">hasTimestamp</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  68. <div class="description">
  69. <p>Whether the backend supports query timestamps or not.</p>
  70. </div>
  71. </div>
  72. <div class="member">
  73. <h3 class="name" id="parameters" translate="no">.<a href="#parameters">parameters</a><span class="type-signature"> : Object</span> </h3>
  74. <div class="description">
  75. <p>The parameters of the backend.</p>
  76. </div>
  77. </div>
  78. <div class="member">
  79. <h3 class="name" id="renderer" translate="no">.<a href="#renderer">renderer</a><span class="type-signature"> : <a href="Renderer.html">Renderer</a></span> </h3>
  80. <div class="description">
  81. <p>A reference to the renderer.</p>
  82. <p>Default is <code>null</code>.</p>
  83. </div>
  84. </div>
  85. <div class="member">
  86. <h3 class="name" id="timestampQueryPool" translate="no">.<a href="#timestampQueryPool">timestampQueryPool</a><span class="type-signature"> : Object</span> </h3>
  87. <div class="description">
  88. <p>A reference to the timestamp query pool.</p>
  89. </div>
  90. </div>
  91. <div class="member">
  92. <h3 class="name" id="trackTimestamp" translate="no">.<a href="#trackTimestamp">trackTimestamp</a><span class="type-signature"> : boolean</span> </h3>
  93. <div class="description">
  94. <p>Whether to track timestamps with a Timestamp Query API or not.</p>
  95. <p>Default is <code>false</code>.</p>
  96. </div>
  97. </div>
  98. <h2 class="subsection-title">Methods</h2>
  99. <h3 class="name name-method" id="_getQueryPool" translate="no">.<a href="#_getQueryPool">_getQueryPool</a><span class="signature">( uid : <span class="param-type">string</span> )</span><span class="type-signature"> : <a href="TimestampQueryPool.html">TimestampQueryPool</a></span> </h3>
  100. <div class="method">
  101. <div class="description">
  102. <p>Returns the query pool for the given uid.</p>
  103. </div>
  104. <table class="params">
  105. <tbody>
  106. <tr>
  107. <td class="name">
  108. <strong translate="no">uid</strong>
  109. </td>
  110. <td class="description last">
  111. <p>The unique identifier.</p>
  112. </td>
  113. </tr>
  114. </tbody>
  115. </table>
  116. <dl class="details">
  117. <dt class="tag-returns"><strong>Returns:</strong> The query pool.</dt>
  118. </dl>
  119. </div>
  120. <h3 class="name name-method" id="beginCompute" translate="no">.<a href="#beginCompute">beginCompute</a><span class="signature">( computeGroup : <span class="param-type"><a href="Node.html">Node</a> | Array.&lt;<a href="Node.html">Node</a>></span> )</span> <span class="type-signature">(abstract) </span></h3>
  121. <div class="method">
  122. <div class="description">
  123. <p>This method is executed at the beginning of a compute call and
  124. can be used by the backend to prepare the state for upcoming
  125. compute tasks.</p>
  126. </div>
  127. <table class="params">
  128. <tbody>
  129. <tr>
  130. <td class="name">
  131. <strong translate="no">computeGroup</strong>
  132. </td>
  133. <td class="description last">
  134. <p>The compute node(s).</p>
  135. </td>
  136. </tr>
  137. </tbody>
  138. </table>
  139. </div>
  140. <h3 class="name name-method" id="beginRender" translate="no">.<a href="#beginRender">beginRender</a><span class="signature">( renderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  141. <div class="method">
  142. <div class="description">
  143. <p>This method is executed at the beginning of a render call and
  144. can be used by the backend to prepare the state for upcoming
  145. draw calls.</p>
  146. </div>
  147. <table class="params">
  148. <tbody>
  149. <tr>
  150. <td class="name">
  151. <strong translate="no">renderContext</strong>
  152. </td>
  153. <td class="description last">
  154. <p>The render context.</p>
  155. </td>
  156. </tr>
  157. </tbody>
  158. </table>
  159. </div>
  160. <h3 class="name name-method" id="compute" translate="no">.<a href="#compute">compute</a><span class="signature">( computeGroup : <span class="param-type"><a href="Node.html">Node</a> | Array.&lt;<a href="Node.html">Node</a>></span>, computeNode : <span class="param-type"><a href="Node.html">Node</a></span>, bindings : <span class="param-type">Array.&lt;<a href="BindGroup.html">BindGroup</a>></span>, computePipeline : <span class="param-type"><a href="ComputePipeline.html">ComputePipeline</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  161. <div class="method">
  162. <div class="description">
  163. <p>Executes a compute command for the given compute node.</p>
  164. </div>
  165. <table class="params">
  166. <tbody>
  167. <tr>
  168. <td class="name">
  169. <strong translate="no">computeGroup</strong>
  170. </td>
  171. <td class="description last">
  172. <p>The group of compute nodes of a compute call. Can be a single compute node.</p>
  173. </td>
  174. </tr>
  175. <tr>
  176. <td class="name">
  177. <strong translate="no">computeNode</strong>
  178. </td>
  179. <td class="description last">
  180. <p>The compute node.</p>
  181. </td>
  182. </tr>
  183. <tr>
  184. <td class="name">
  185. <strong translate="no">bindings</strong>
  186. </td>
  187. <td class="description last">
  188. <p>The bindings.</p>
  189. </td>
  190. </tr>
  191. <tr>
  192. <td class="name">
  193. <strong translate="no">computePipeline</strong>
  194. </td>
  195. <td class="description last">
  196. <p>The compute pipeline.</p>
  197. </td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. </div>
  202. <h3 class="name name-method" id="copyFramebufferToTexture" translate="no">.<a href="#copyFramebufferToTexture">copyFramebufferToTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, renderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a></span>, rectangle : <span class="param-type"><a href="Vector4.html">Vector4</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  203. <div class="method">
  204. <div class="description">
  205. <p>Copies the current bound framebuffer to the given texture.</p>
  206. </div>
  207. <table class="params">
  208. <tbody>
  209. <tr>
  210. <td class="name">
  211. <strong translate="no">texture</strong>
  212. </td>
  213. <td class="description last">
  214. <p>The destination texture.</p>
  215. </td>
  216. </tr>
  217. <tr>
  218. <td class="name">
  219. <strong translate="no">renderContext</strong>
  220. </td>
  221. <td class="description last">
  222. <p>The render context.</p>
  223. </td>
  224. </tr>
  225. <tr>
  226. <td class="name">
  227. <strong translate="no">rectangle</strong>
  228. </td>
  229. <td class="description last">
  230. <p>A four dimensional vector defining the origin and dimension of the copy.</p>
  231. </td>
  232. </tr>
  233. </tbody>
  234. </table>
  235. </div>
  236. <h3 class="name name-method" id="copyTextureToBuffer" translate="no">.<a href="#copyTextureToBuffer">copyTextureToBuffer</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</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>, faceIndex : <span class="param-type">number</span> )</span><span class="type-signature"> : Promise.&lt;TypedArray></span> <span class="type-signature">(async, abstract) </span></h3>
  237. <div class="method">
  238. <div class="description">
  239. <p>Returns texture data as a typed array.</p>
  240. </div>
  241. <table class="params">
  242. <tbody>
  243. <tr>
  244. <td class="name">
  245. <strong translate="no">texture</strong>
  246. </td>
  247. <td class="description last">
  248. <p>The texture to copy.</p>
  249. </td>
  250. </tr>
  251. <tr>
  252. <td class="name">
  253. <strong translate="no">x</strong>
  254. </td>
  255. <td class="description last">
  256. <p>The x coordinate of the copy origin.</p>
  257. </td>
  258. </tr>
  259. <tr>
  260. <td class="name">
  261. <strong translate="no">y</strong>
  262. </td>
  263. <td class="description last">
  264. <p>The y coordinate of the copy origin.</p>
  265. </td>
  266. </tr>
  267. <tr>
  268. <td class="name">
  269. <strong translate="no">width</strong>
  270. </td>
  271. <td class="description last">
  272. <p>The width of the copy.</p>
  273. </td>
  274. </tr>
  275. <tr>
  276. <td class="name">
  277. <strong translate="no">height</strong>
  278. </td>
  279. <td class="description last">
  280. <p>The height of the copy.</p>
  281. </td>
  282. </tr>
  283. <tr>
  284. <td class="name">
  285. <strong translate="no">faceIndex</strong>
  286. </td>
  287. <td class="description last">
  288. <p>The face index.</p>
  289. </td>
  290. </tr>
  291. </tbody>
  292. </table>
  293. <dl class="details">
  294. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves with a typed array when the copy operation has finished.</dt>
  295. </dl>
  296. </div>
  297. <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="Box3.html">Box3</a> | <a href="Box2.html">Box2</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> <span class="type-signature">(abstract) </span></h3>
  298. <div class="method">
  299. <div class="description">
  300. <p>Copies data of the given source texture to the given destination texture.</p>
  301. </div>
  302. <table class="params">
  303. <tbody>
  304. <tr>
  305. <td class="name">
  306. <strong translate="no">srcTexture</strong>
  307. </td>
  308. <td class="description last">
  309. <p>The source texture.</p>
  310. </td>
  311. </tr>
  312. <tr>
  313. <td class="name">
  314. <strong translate="no">dstTexture</strong>
  315. </td>
  316. <td class="description last">
  317. <p>The destination texture.</p>
  318. </td>
  319. </tr>
  320. <tr>
  321. <td class="name">
  322. <strong translate="no">srcRegion</strong>
  323. </td>
  324. <td class="description last">
  325. <p>The region of the source texture to copy.</p>
  326. <p>Default is <code>null</code>.</p>
  327. </td>
  328. </tr>
  329. <tr>
  330. <td class="name">
  331. <strong translate="no">dstPosition</strong>
  332. </td>
  333. <td class="description last">
  334. <p>The destination position of the copy.</p>
  335. <p>Default is <code>null</code>.</p>
  336. </td>
  337. </tr>
  338. <tr>
  339. <td class="name">
  340. <strong translate="no">srcLevel</strong>
  341. </td>
  342. <td class="description last">
  343. <p>The source mip level to copy from.</p>
  344. <p>Default is <code>0</code>.</p>
  345. </td>
  346. </tr>
  347. <tr>
  348. <td class="name">
  349. <strong translate="no">dstLevel</strong>
  350. </td>
  351. <td class="description last">
  352. <p>The destination mip level to copy to.</p>
  353. <p>Default is <code>0</code>.</p>
  354. </td>
  355. </tr>
  356. </tbody>
  357. </table>
  358. </div>
  359. <h3 class="name name-method" id="createAttribute" translate="no">.<a href="#createAttribute">createAttribute</a><span class="signature">( attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  360. <div class="method">
  361. <div class="description">
  362. <p>Creates the GPU buffer of a shader attribute.</p>
  363. </div>
  364. <table class="params">
  365. <tbody>
  366. <tr>
  367. <td class="name">
  368. <strong translate="no">attribute</strong>
  369. </td>
  370. <td class="description last">
  371. <p>The buffer attribute.</p>
  372. </td>
  373. </tr>
  374. </tbody>
  375. </table>
  376. </div>
  377. <h3 class="name name-method" id="createBindings" translate="no">.<a href="#createBindings">createBindings</a><span class="signature">( bindGroup : <span class="param-type"><a href="BindGroup.html">BindGroup</a></span>, bindings : <span class="param-type">Array.&lt;<a href="BindGroup.html">BindGroup</a>></span>, cacheIndex : <span class="param-type">number</span>, version : <span class="param-type">number</span> )</span> <span class="type-signature">(abstract) </span></h3>
  378. <div class="method">
  379. <div class="description">
  380. <p>Creates bindings from the given bind group definition.</p>
  381. </div>
  382. <table class="params">
  383. <tbody>
  384. <tr>
  385. <td class="name">
  386. <strong translate="no">bindGroup</strong>
  387. </td>
  388. <td class="description last">
  389. <p>The bind group.</p>
  390. </td>
  391. </tr>
  392. <tr>
  393. <td class="name">
  394. <strong translate="no">bindings</strong>
  395. </td>
  396. <td class="description last">
  397. <p>Array of bind groups.</p>
  398. </td>
  399. </tr>
  400. <tr>
  401. <td class="name">
  402. <strong translate="no">cacheIndex</strong>
  403. </td>
  404. <td class="description last">
  405. <p>The cache index.</p>
  406. </td>
  407. </tr>
  408. <tr>
  409. <td class="name">
  410. <strong translate="no">version</strong>
  411. </td>
  412. <td class="description last">
  413. <p>The version.</p>
  414. </td>
  415. </tr>
  416. </tbody>
  417. </table>
  418. </div>
  419. <h3 class="name name-method" id="createComputePipeline" translate="no">.<a href="#createComputePipeline">createComputePipeline</a><span class="signature">( computePipeline : <span class="param-type"><a href="ComputePipeline.html">ComputePipeline</a></span>, bindings : <span class="param-type">Array.&lt;<a href="BindGroup.html">BindGroup</a>></span> )</span> <span class="type-signature">(abstract) </span></h3>
  420. <div class="method">
  421. <div class="description">
  422. <p>Creates a compute pipeline for the given compute node.</p>
  423. </div>
  424. <table class="params">
  425. <tbody>
  426. <tr>
  427. <td class="name">
  428. <strong translate="no">computePipeline</strong>
  429. </td>
  430. <td class="description last">
  431. <p>The compute pipeline.</p>
  432. </td>
  433. </tr>
  434. <tr>
  435. <td class="name">
  436. <strong translate="no">bindings</strong>
  437. </td>
  438. <td class="description last">
  439. <p>The bindings.</p>
  440. </td>
  441. </tr>
  442. </tbody>
  443. </table>
  444. </div>
  445. <h3 class="name name-method" id="createDefaultTexture" translate="no">.<a href="#createDefaultTexture">createDefaultTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  446. <div class="method">
  447. <div class="description">
  448. <p>Creates a default texture for the given texture that can be used
  449. as a placeholder until the actual texture is ready for usage.</p>
  450. </div>
  451. <table class="params">
  452. <tbody>
  453. <tr>
  454. <td class="name">
  455. <strong translate="no">texture</strong>
  456. </td>
  457. <td class="description last">
  458. <p>The texture to create a default texture for.</p>
  459. </td>
  460. </tr>
  461. </tbody>
  462. </table>
  463. </div>
  464. <h3 class="name name-method" id="createIndexAttribute" translate="no">.<a href="#createIndexAttribute">createIndexAttribute</a><span class="signature">( attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  465. <div class="method">
  466. <div class="description">
  467. <p>Creates the GPU buffer of an indexed shader attribute.</p>
  468. </div>
  469. <table class="params">
  470. <tbody>
  471. <tr>
  472. <td class="name">
  473. <strong translate="no">attribute</strong>
  474. </td>
  475. <td class="description last">
  476. <p>The indexed buffer attribute.</p>
  477. </td>
  478. </tr>
  479. </tbody>
  480. </table>
  481. </div>
  482. <h3 class="name name-method" id="createNodeBuilder" translate="no">.<a href="#createNodeBuilder">createNodeBuilder</a><span class="signature">( renderObject : <span class="param-type"><a href="RenderObject.html">RenderObject</a></span>, renderer : <span class="param-type"><a href="Renderer.html">Renderer</a></span> )</span><span class="type-signature"> : <a href="NodeBuilder.html">NodeBuilder</a></span> <span class="type-signature">(abstract) </span></h3>
  483. <div class="method">
  484. <div class="description">
  485. <p>Returns a node builder for the given render object.</p>
  486. </div>
  487. <table class="params">
  488. <tbody>
  489. <tr>
  490. <td class="name">
  491. <strong translate="no">renderObject</strong>
  492. </td>
  493. <td class="description last">
  494. <p>The render object.</p>
  495. </td>
  496. </tr>
  497. <tr>
  498. <td class="name">
  499. <strong translate="no">renderer</strong>
  500. </td>
  501. <td class="description last">
  502. <p>The renderer.</p>
  503. </td>
  504. </tr>
  505. </tbody>
  506. </table>
  507. <dl class="details">
  508. <dt class="tag-returns"><strong>Returns:</strong> The node builder.</dt>
  509. </dl>
  510. </div>
  511. <h3 class="name name-method" id="createProgram" translate="no">.<a href="#createProgram">createProgram</a><span class="signature">( program : <span class="param-type"><a href="ProgrammableStage.html">ProgrammableStage</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  512. <div class="method">
  513. <div class="description">
  514. <p>Creates a shader program from the given programmable stage.</p>
  515. </div>
  516. <table class="params">
  517. <tbody>
  518. <tr>
  519. <td class="name">
  520. <strong translate="no">program</strong>
  521. </td>
  522. <td class="description last">
  523. <p>The programmable stage.</p>
  524. </td>
  525. </tr>
  526. </tbody>
  527. </table>
  528. </div>
  529. <h3 class="name name-method" id="createRenderPipeline" translate="no">.<a href="#createRenderPipeline">createRenderPipeline</a><span class="signature">( renderObject : <span class="param-type"><a href="RenderObject.html">RenderObject</a></span>, promises : <span class="param-type">Array.&lt;Promise></span> )</span> <span class="type-signature">(abstract) </span></h3>
  530. <div class="method">
  531. <div class="description">
  532. <p>Creates a render pipeline for the given render object.</p>
  533. </div>
  534. <table class="params">
  535. <tbody>
  536. <tr>
  537. <td class="name">
  538. <strong translate="no">renderObject</strong>
  539. </td>
  540. <td class="description last">
  541. <p>The render object.</p>
  542. </td>
  543. </tr>
  544. <tr>
  545. <td class="name">
  546. <strong translate="no">promises</strong>
  547. </td>
  548. <td class="description last">
  549. <p>An array of compilation promises which are used in <code>compileAsync()</code>.</p>
  550. </td>
  551. </tr>
  552. </tbody>
  553. </table>
  554. </div>
  555. <h3 class="name name-method" id="createStorageAttribute" translate="no">.<a href="#createStorageAttribute">createStorageAttribute</a><span class="signature">( attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  556. <div class="method">
  557. <div class="description">
  558. <p>Creates the GPU buffer of a storage attribute.</p>
  559. </div>
  560. <table class="params">
  561. <tbody>
  562. <tr>
  563. <td class="name">
  564. <strong translate="no">attribute</strong>
  565. </td>
  566. <td class="description last">
  567. <p>The buffer attribute.</p>
  568. </td>
  569. </tr>
  570. </tbody>
  571. </table>
  572. </div>
  573. <h3 class="name name-method" id="createTexture" translate="no">.<a href="#createTexture">createTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, options : <span class="param-type">Object</span> )</span> <span class="type-signature">(abstract) </span></h3>
  574. <div class="method">
  575. <div class="description">
  576. <p>Defines a texture on the GPU for the given texture object.</p>
  577. </div>
  578. <table class="params">
  579. <tbody>
  580. <tr>
  581. <td class="name">
  582. <strong translate="no">texture</strong>
  583. </td>
  584. <td class="description last">
  585. <p>The texture.</p>
  586. </td>
  587. </tr>
  588. <tr>
  589. <td class="name">
  590. <strong translate="no">options</strong>
  591. </td>
  592. <td class="description last">
  593. <p>Optional configuration parameter.</p>
  594. <p>Default is <code>{}</code>.</p>
  595. </td>
  596. </tr>
  597. </tbody>
  598. </table>
  599. </div>
  600. <h3 class="name name-method" id="createUniformBuffer" translate="no">.<a href="#createUniformBuffer">createUniformBuffer</a><span class="signature">( uniformBuffer : <span class="param-type"><a href="Buffer.html">Buffer</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  601. <div class="method">
  602. <div class="description">
  603. <p>Creates a uniform buffer.</p>
  604. </div>
  605. <table class="params">
  606. <tbody>
  607. <tr>
  608. <td class="name">
  609. <strong translate="no">uniformBuffer</strong>
  610. </td>
  611. <td class="description last">
  612. <p>The uniform buffer.</p>
  613. </td>
  614. </tr>
  615. </tbody>
  616. </table>
  617. </div>
  618. <h3 class="name name-method" id="delete" translate="no">.<a href="#delete">delete</a><span class="signature">( object : <span class="param-type">Object</span> )</span> </h3>
  619. <div class="method">
  620. <div class="description">
  621. <p>Deletes an object from the internal data structure.</p>
  622. </div>
  623. <table class="params">
  624. <tbody>
  625. <tr>
  626. <td class="name">
  627. <strong translate="no">object</strong>
  628. </td>
  629. <td class="description last">
  630. <p>The object to delete.</p>
  631. </td>
  632. </tr>
  633. </tbody>
  634. </table>
  635. </div>
  636. <h3 class="name name-method" id="deleteBindGroupData" translate="no">.<a href="#deleteBindGroupData">deleteBindGroupData</a><span class="signature">( bindGroup : <span class="param-type"><a href="BindGroup.html">BindGroup</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  637. <div class="method">
  638. <div class="description">
  639. <p>Delete GPU data associated with a bind group.</p>
  640. </div>
  641. <table class="params">
  642. <tbody>
  643. <tr>
  644. <td class="name">
  645. <strong translate="no">bindGroup</strong>
  646. </td>
  647. <td class="description last">
  648. <p>The bind group.</p>
  649. </td>
  650. </tr>
  651. </tbody>
  652. </table>
  653. </div>
  654. <h3 class="name name-method" id="destroyAttribute" translate="no">.<a href="#destroyAttribute">destroyAttribute</a><span class="signature">( attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  655. <div class="method">
  656. <div class="description">
  657. <p>Destroys the GPU buffer of a shader attribute.</p>
  658. </div>
  659. <table class="params">
  660. <tbody>
  661. <tr>
  662. <td class="name">
  663. <strong translate="no">attribute</strong>
  664. </td>
  665. <td class="description last">
  666. <p>The buffer attribute to destroy.</p>
  667. </td>
  668. </tr>
  669. </tbody>
  670. </table>
  671. </div>
  672. <h3 class="name name-method" id="destroyProgram" translate="no">.<a href="#destroyProgram">destroyProgram</a><span class="signature">( program : <span class="param-type"><a href="ProgrammableStage.html">ProgrammableStage</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  673. <div class="method">
  674. <div class="description">
  675. <p>Destroys the shader program of the given programmable stage.</p>
  676. </div>
  677. <table class="params">
  678. <tbody>
  679. <tr>
  680. <td class="name">
  681. <strong translate="no">program</strong>
  682. </td>
  683. <td class="description last">
  684. <p>The programmable stage.</p>
  685. </td>
  686. </tr>
  687. </tbody>
  688. </table>
  689. </div>
  690. <h3 class="name name-method" id="destroySampler" translate="no">.<a href="#destroySampler">destroySampler</a><span class="signature">( binding : <span class="param-type"><a href="Sampler.html">Sampler</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  691. <div class="method">
  692. <div class="description">
  693. <p>Frees the GPU sampler for the given sampler binding.</p>
  694. </div>
  695. <table class="params">
  696. <tbody>
  697. <tr>
  698. <td class="name">
  699. <strong translate="no">binding</strong>
  700. </td>
  701. <td class="description last">
  702. <p>The sampler binding to free.</p>
  703. </td>
  704. </tr>
  705. </tbody>
  706. </table>
  707. </div>
  708. <h3 class="name name-method" id="destroyTexture" translate="no">.<a href="#destroyTexture">destroyTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, isDefaultTexture : <span class="param-type">boolean</span> )</span> <span class="type-signature">(abstract) </span></h3>
  709. <div class="method">
  710. <div class="description">
  711. <p>Destroys the GPU data for the given texture object.</p>
  712. </div>
  713. <table class="params">
  714. <tbody>
  715. <tr>
  716. <td class="name">
  717. <strong translate="no">texture</strong>
  718. </td>
  719. <td class="description last">
  720. <p>The texture.</p>
  721. </td>
  722. </tr>
  723. <tr>
  724. <td class="name">
  725. <strong translate="no">isDefaultTexture</strong>
  726. </td>
  727. <td class="description last">
  728. <p>Whether the texture uses a default GPU texture or not.</p>
  729. <p>Default is <code>false</code>.</p>
  730. </td>
  731. </tr>
  732. </tbody>
  733. </table>
  734. </div>
  735. <h3 class="name name-method" id="destroyUniformBuffer" translate="no">.<a href="#destroyUniformBuffer">destroyUniformBuffer</a><span class="signature">( uniformBuffer : <span class="param-type"><a href="Buffer.html">Buffer</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  736. <div class="method">
  737. <div class="description">
  738. <p>Destroys a uniform buffer.</p>
  739. </div>
  740. <table class="params">
  741. <tbody>
  742. <tr>
  743. <td class="name">
  744. <strong translate="no">uniformBuffer</strong>
  745. </td>
  746. <td class="description last">
  747. <p>The uniform buffer.</p>
  748. </td>
  749. </tr>
  750. </tbody>
  751. </table>
  752. </div>
  753. <h3 class="name name-method" id="dispose" translate="no">.<a href="#dispose">dispose</a><span class="signature">()</span> <span class="type-signature">(abstract) </span></h3>
  754. <div class="method">
  755. <div class="description">
  756. <p>Frees internal resources.</p>
  757. </div>
  758. </div>
  759. <h3 class="name name-method" id="draw" translate="no">.<a href="#draw">draw</a><span class="signature">( renderObject : <span class="param-type"><a href="RenderObject.html">RenderObject</a></span>, info : <span class="param-type"><a href="Info.html">Info</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  760. <div class="method">
  761. <div class="description">
  762. <p>Executes a draw command for the given render object.</p>
  763. </div>
  764. <table class="params">
  765. <tbody>
  766. <tr>
  767. <td class="name">
  768. <strong translate="no">renderObject</strong>
  769. </td>
  770. <td class="description last">
  771. <p>The render object to draw.</p>
  772. </td>
  773. </tr>
  774. <tr>
  775. <td class="name">
  776. <strong translate="no">info</strong>
  777. </td>
  778. <td class="description last">
  779. <p>Holds a series of statistical information about the GPU memory and the rendering process.</p>
  780. </td>
  781. </tr>
  782. </tbody>
  783. </table>
  784. </div>
  785. <h3 class="name name-method" id="finishCompute" translate="no">.<a href="#finishCompute">finishCompute</a><span class="signature">( computeGroup : <span class="param-type"><a href="Node.html">Node</a> | Array.&lt;<a href="Node.html">Node</a>></span> )</span> <span class="type-signature">(abstract) </span></h3>
  786. <div class="method">
  787. <div class="description">
  788. <p>This method is executed at the end of a compute call and
  789. can be used by the backend to finalize work after compute
  790. tasks.</p>
  791. </div>
  792. <table class="params">
  793. <tbody>
  794. <tr>
  795. <td class="name">
  796. <strong translate="no">computeGroup</strong>
  797. </td>
  798. <td class="description last">
  799. <p>The compute node(s).</p>
  800. </td>
  801. </tr>
  802. </tbody>
  803. </table>
  804. </div>
  805. <h3 class="name name-method" id="finishRender" translate="no">.<a href="#finishRender">finishRender</a><span class="signature">( renderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  806. <div class="method">
  807. <div class="description">
  808. <p>This method is executed at the end of a render call and
  809. can be used by the backend to finalize work after draw
  810. calls.</p>
  811. </div>
  812. <table class="params">
  813. <tbody>
  814. <tr>
  815. <td class="name">
  816. <strong translate="no">renderContext</strong>
  817. </td>
  818. <td class="description last">
  819. <p>The render context.</p>
  820. </td>
  821. </tr>
  822. </tbody>
  823. </table>
  824. </div>
  825. <h3 class="name name-method" id="generateMipmaps" translate="no">.<a href="#generateMipmaps">generateMipmaps</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  826. <div class="method">
  827. <div class="description">
  828. <p>Generates mipmaps for the given texture.</p>
  829. </div>
  830. <table class="params">
  831. <tbody>
  832. <tr>
  833. <td class="name">
  834. <strong translate="no">texture</strong>
  835. </td>
  836. <td class="description last">
  837. <p>The texture.</p>
  838. </td>
  839. </tr>
  840. </tbody>
  841. </table>
  842. </div>
  843. <h3 class="name name-method" id="get" translate="no">.<a href="#get">get</a><span class="signature">( object : <span class="param-type">Object</span> )</span><span class="type-signature"> : Object</span> </h3>
  844. <div class="method">
  845. <div class="description">
  846. <p>Returns the dictionary for the given object.</p>
  847. </div>
  848. <table class="params">
  849. <tbody>
  850. <tr>
  851. <td class="name">
  852. <strong translate="no">object</strong>
  853. </td>
  854. <td class="description last">
  855. <p>The object.</p>
  856. </td>
  857. </tr>
  858. </tbody>
  859. </table>
  860. <dl class="details">
  861. <dt class="tag-returns"><strong>Returns:</strong> The object's dictionary.</dt>
  862. </dl>
  863. </div>
  864. <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>
  865. <div class="method">
  866. <div class="description">
  867. <p>This method performs a readback operation by moving buffer data from
  868. a storage buffer attribute from the GPU to the CPU.</p>
  869. </div>
  870. <table class="params">
  871. <tbody>
  872. <tr>
  873. <td class="name">
  874. <strong translate="no">attribute</strong>
  875. </td>
  876. <td class="description last">
  877. <p>The storage buffer attribute.</p>
  878. </td>
  879. </tr>
  880. </tbody>
  881. </table>
  882. <dl class="details">
  883. <dt class="tag-returns"><strong>Returns:</strong> A promise that resolves with the buffer data when the data are ready.</dt>
  884. </dl>
  885. </div>
  886. <h3 class="name name-method" id="getClearColor" translate="no">.<a href="#getClearColor">getClearColor</a><span class="signature">()</span><span class="type-signature"> : <a href="Color4.html">Color4</a></span> </h3>
  887. <div class="method">
  888. <div class="description">
  889. <p>Returns the clear color and alpha into a single
  890. color object.</p>
  891. </div>
  892. <dl class="details">
  893. <dt class="tag-returns"><strong>Returns:</strong> The clear color.</dt>
  894. </dl>
  895. </div>
  896. <h3 class="name name-method" id="getContext" translate="no">.<a href="#getContext">getContext</a><span class="signature">()</span><span class="type-signature"> : Object</span> <span class="type-signature">(abstract) </span></h3>
  897. <div class="method">
  898. <div class="description">
  899. <p>Returns the backend's rendering context.</p>
  900. </div>
  901. <dl class="details">
  902. <dt class="tag-returns"><strong>Returns:</strong> The rendering context.</dt>
  903. </dl>
  904. </div>
  905. <h3 class="name name-method" id="getDomElement" translate="no">.<a href="#getDomElement">getDomElement</a><span class="signature">()</span><span class="type-signature"> : HTMLCanvasElement</span> </h3>
  906. <div class="method">
  907. <div class="description">
  908. <p>Returns the DOM element. If no DOM element exists, the backend
  909. creates a new one.</p>
  910. </div>
  911. <dl class="details">
  912. <dt class="tag-returns"><strong>Returns:</strong> The DOM element.</dt>
  913. </dl>
  914. </div>
  915. <h3 class="name name-method" id="getDrawingBufferSize" translate="no">.<a href="#getDrawingBufferSize">getDrawingBufferSize</a><span class="signature">()</span><span class="type-signature"> : <a href="Vector2.html">Vector2</a></span> </h3>
  916. <div class="method">
  917. <div class="description">
  918. <p>Returns the drawing buffer size.</p>
  919. </div>
  920. <dl class="details">
  921. <dt class="tag-returns"><strong>Returns:</strong> The drawing buffer size.</dt>
  922. </dl>
  923. </div>
  924. <h3 class="name name-method" id="getRenderCacheKey" translate="no">.<a href="#getRenderCacheKey">getRenderCacheKey</a><span class="signature">( renderObject : <span class="param-type"><a href="RenderObject.html">RenderObject</a></span> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  925. <div class="method">
  926. <div class="description">
  927. <p>Returns a cache key that is used to identify render pipelines.</p>
  928. </div>
  929. <table class="params">
  930. <tbody>
  931. <tr>
  932. <td class="name">
  933. <strong translate="no">renderObject</strong>
  934. </td>
  935. <td class="description last">
  936. <p>The render object.</p>
  937. </td>
  938. </tr>
  939. </tbody>
  940. </table>
  941. <dl class="details">
  942. <dt class="tag-returns"><strong>Returns:</strong> The cache key.</dt>
  943. </dl>
  944. </div>
  945. <h3 class="name name-method" id="getTimestamp" translate="no">.<a href="#getTimestamp">getTimestamp</a><span class="signature">( uid : <span class="param-type">string</span> )</span><span class="type-signature"> : number</span> </h3>
  946. <div class="method">
  947. <div class="description">
  948. <p>Returns the timestamp for the given uid.</p>
  949. </div>
  950. <table class="params">
  951. <tbody>
  952. <tr>
  953. <td class="name">
  954. <strong translate="no">uid</strong>
  955. </td>
  956. <td class="description last">
  957. <p>The unique identifier.</p>
  958. </td>
  959. </tr>
  960. </tbody>
  961. </table>
  962. <dl class="details">
  963. <dt class="tag-returns"><strong>Returns:</strong> The timestamp.</dt>
  964. </dl>
  965. </div>
  966. <h3 class="name name-method" id="getTimestampFrames" translate="no">.<a href="#getTimestampFrames">getTimestampFrames</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : Array.&lt;number></span> </h3>
  967. <div class="method">
  968. <div class="description">
  969. <p>Returns all timestamp frames for the given type.</p>
  970. </div>
  971. <table class="params">
  972. <tbody>
  973. <tr>
  974. <td class="name">
  975. <strong translate="no">type</strong>
  976. </td>
  977. <td class="description last">
  978. <p>The type of the time stamp.</p>
  979. </td>
  980. </tr>
  981. </tbody>
  982. </table>
  983. <dl class="details">
  984. <dt class="tag-returns"><strong>Returns:</strong> The timestamp frames.</dt>
  985. </dl>
  986. </div>
  987. <h3 class="name name-method" id="getTimestampUID" translate="no">.<a href="#getTimestampUID">getTimestampUID</a><span class="signature">( abstractRenderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a> | <a href="ComputeNode.html">ComputeNode</a></span> )</span><span class="type-signature"> : string</span> </h3>
  988. <div class="method">
  989. <div class="description">
  990. <p>Returns a unique identifier for the given render context that can be used
  991. to allocate resources like occlusion queries or timestamp queries.</p>
  992. </div>
  993. <table class="params">
  994. <tbody>
  995. <tr>
  996. <td class="name">
  997. <strong translate="no">abstractRenderContext</strong>
  998. </td>
  999. <td class="description last">
  1000. <p>The render context.</p>
  1001. </td>
  1002. </tr>
  1003. </tbody>
  1004. </table>
  1005. <dl class="details">
  1006. <dt class="tag-returns"><strong>Returns:</strong> The unique identifier.</dt>
  1007. </dl>
  1008. </div>
  1009. <h3 class="name name-method" id="has" translate="no">.<a href="#has">has</a><span class="signature">( object : <span class="param-type">Object</span> )</span><span class="type-signature"> : boolean</span> </h3>
  1010. <div class="method">
  1011. <div class="description">
  1012. <p>Checks if the given object has a dictionary
  1013. with data defined.</p>
  1014. </div>
  1015. <table class="params">
  1016. <tbody>
  1017. <tr>
  1018. <td class="name">
  1019. <strong translate="no">object</strong>
  1020. </td>
  1021. <td class="description last">
  1022. <p>The object.</p>
  1023. </td>
  1024. </tr>
  1025. </tbody>
  1026. </table>
  1027. <dl class="details">
  1028. <dt class="tag-returns"><strong>Returns:</strong> Whether a dictionary for the given object as been defined or not.</dt>
  1029. </dl>
  1030. </div>
  1031. <h3 class="name name-method" id="hasCompatibility" translate="no">.<a href="#hasCompatibility">hasCompatibility</a><span class="signature">( name : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> <span class="type-signature">(abstract) </span></h3>
  1032. <div class="method">
  1033. <div class="description">
  1034. <p>Checks if the backend has the given compatibility.</p>
  1035. </div>
  1036. <table class="params">
  1037. <tbody>
  1038. <tr>
  1039. <td class="name">
  1040. <strong translate="no">name</strong>
  1041. </td>
  1042. <td class="description last">
  1043. <p>The compatibility.</p>
  1044. </td>
  1045. </tr>
  1046. </tbody>
  1047. </table>
  1048. <dl class="details">
  1049. <dt class="tag-returns"><strong>Returns:</strong> Whether the backend has the given compatibility or not.</dt>
  1050. </dl>
  1051. </div>
  1052. <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> <span class="type-signature">(abstract) </span></h3>
  1053. <div class="method">
  1054. <div class="description">
  1055. <p>Checks if the given feature is supported by the backend.</p>
  1056. </div>
  1057. <table class="params">
  1058. <tbody>
  1059. <tr>
  1060. <td class="name">
  1061. <strong translate="no">name</strong>
  1062. </td>
  1063. <td class="description last">
  1064. <p>The feature's name.</p>
  1065. </td>
  1066. </tr>
  1067. </tbody>
  1068. </table>
  1069. <dl class="details">
  1070. <dt class="tag-returns"><strong>Returns:</strong> Whether the feature is supported or not.</dt>
  1071. </dl>
  1072. </div>
  1073. <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, abstract) </span></h3>
  1074. <div class="method">
  1075. <div class="description">
  1076. <p>Checks if the given feature is supported by the backend.</p>
  1077. </div>
  1078. <table class="params">
  1079. <tbody>
  1080. <tr>
  1081. <td class="name">
  1082. <strong translate="no">name</strong>
  1083. </td>
  1084. <td class="description last">
  1085. <p>The feature's name.</p>
  1086. </td>
  1087. </tr>
  1088. </tbody>
  1089. </table>
  1090. <dl class="details">
  1091. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves with a bool that indicates whether the feature is supported or not.</dt>
  1092. </dl>
  1093. </div>
  1094. <h3 class="name name-method" id="hasTimestampQuery" translate="no">.<a href="#hasTimestampQuery">hasTimestampQuery</a><span class="signature">( uid : <span class="param-type">string</span> )</span><span class="type-signature"> : boolean</span> </h3>
  1095. <div class="method">
  1096. <div class="description">
  1097. <p>Returns <code>true</code> if a timestamp for the given uid is available.</p>
  1098. </div>
  1099. <table class="params">
  1100. <tbody>
  1101. <tr>
  1102. <td class="name">
  1103. <strong translate="no">uid</strong>
  1104. </td>
  1105. <td class="description last">
  1106. <p>The unique identifier.</p>
  1107. </td>
  1108. </tr>
  1109. </tbody>
  1110. </table>
  1111. <dl class="details">
  1112. <dt class="tag-returns"><strong>Returns:</strong> Whether the timestamp is available or not.</dt>
  1113. </dl>
  1114. </div>
  1115. <h3 class="name name-method" id="init" translate="no">.<a href="#init">init</a><span class="signature">( renderer : <span class="param-type"><a href="Renderer.html">Renderer</a></span> )</span><span class="type-signature"> : Promise</span> <span class="type-signature">(async) </span></h3>
  1116. <div class="method">
  1117. <div class="description">
  1118. <p>Initializes the backend so it is ready for usage. Concrete backends
  1119. are supposed to implement their rendering context creation and related
  1120. operations in this method.</p>
  1121. </div>
  1122. <table class="params">
  1123. <tbody>
  1124. <tr>
  1125. <td class="name">
  1126. <strong translate="no">renderer</strong>
  1127. </td>
  1128. <td class="description last">
  1129. <p>The renderer.</p>
  1130. </td>
  1131. </tr>
  1132. </tbody>
  1133. </table>
  1134. <dl class="details">
  1135. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves when the backend has been initialized.</dt>
  1136. </dl>
  1137. </div>
  1138. <h3 class="name name-method" id="initRenderTarget" translate="no">.<a href="#initRenderTarget">initRenderTarget</a><span class="signature">( renderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  1139. <div class="method">
  1140. <div class="description">
  1141. <p>Initializes the render target defined in the given render context.</p>
  1142. </div>
  1143. <table class="params">
  1144. <tbody>
  1145. <tr>
  1146. <td class="name">
  1147. <strong translate="no">renderContext</strong>
  1148. </td>
  1149. <td class="description last">
  1150. <p>The render context.</p>
  1151. </td>
  1152. </tr>
  1153. </tbody>
  1154. </table>
  1155. </div>
  1156. <h3 class="name name-method" id="isOccluded" translate="no">.<a href="#isOccluded">isOccluded</a><span class="signature">( renderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a></span>, object : <span class="param-type"><a href="Object3D.html">Object3D</a></span> )</span><span class="type-signature"> : boolean</span> <span class="type-signature">(abstract) </span></h3>
  1157. <div class="method">
  1158. <div class="description">
  1159. <p>Returns <code>true</code> if the given 3D object is fully occluded by other
  1160. 3D objects in the scene. Backends must implement this method by using
  1161. a Occlusion Query API.</p>
  1162. </div>
  1163. <table class="params">
  1164. <tbody>
  1165. <tr>
  1166. <td class="name">
  1167. <strong translate="no">renderContext</strong>
  1168. </td>
  1169. <td class="description last">
  1170. <p>The render context.</p>
  1171. </td>
  1172. </tr>
  1173. <tr>
  1174. <td class="name">
  1175. <strong translate="no">object</strong>
  1176. </td>
  1177. <td class="description last">
  1178. <p>The 3D object to test.</p>
  1179. </td>
  1180. </tr>
  1181. </tbody>
  1182. </table>
  1183. <dl class="details">
  1184. <dt class="tag-returns"><strong>Returns:</strong> Whether the 3D object is fully occluded or not.</dt>
  1185. </dl>
  1186. </div>
  1187. <h3 class="name name-method" id="needsRenderUpdate" translate="no">.<a href="#needsRenderUpdate">needsRenderUpdate</a><span class="signature">( renderObject : <span class="param-type"><a href="RenderObject.html">RenderObject</a></span> )</span><span class="type-signature"> : boolean</span> <span class="type-signature">(abstract) </span></h3>
  1188. <div class="method">
  1189. <div class="description">
  1190. <p>Returns <code>true</code> if the render pipeline requires an update.</p>
  1191. </div>
  1192. <table class="params">
  1193. <tbody>
  1194. <tr>
  1195. <td class="name">
  1196. <strong translate="no">renderObject</strong>
  1197. </td>
  1198. <td class="description last">
  1199. <p>The render object.</p>
  1200. </td>
  1201. </tr>
  1202. </tbody>
  1203. </table>
  1204. <dl class="details">
  1205. <dt class="tag-returns"><strong>Returns:</strong> Whether the render pipeline requires an update or not.</dt>
  1206. </dl>
  1207. </div>
  1208. <h3 class="name name-method" id="resolveTimestampsAsync" translate="no">.<a href="#resolveTimestampsAsync">resolveTimestampsAsync</a><span class="signature">( type : <span class="param-type">string</span> )</span><span class="type-signature"> : Promise.&lt;number></span> <span class="type-signature">(async, abstract) </span></h3>
  1209. <div class="method">
  1210. <div class="description">
  1211. <p>Resolves the time stamp for the given render context and type.</p>
  1212. </div>
  1213. <table class="params">
  1214. <tbody>
  1215. <tr>
  1216. <td class="name">
  1217. <strong translate="no">type</strong>
  1218. </td>
  1219. <td class="description last">
  1220. <p>The type of the time stamp.</p>
  1221. <p>Default is <code>'render'</code>.</p>
  1222. </td>
  1223. </tr>
  1224. </tbody>
  1225. </table>
  1226. <dl class="details">
  1227. <dt class="tag-returns"><strong>Returns:</strong> A Promise that resolves with the time stamp.</dt>
  1228. </dl>
  1229. </div>
  1230. <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( object : <span class="param-type">Object</span>, value : <span class="param-type">Object</span> )</span> </h3>
  1231. <div class="method">
  1232. <div class="description">
  1233. <p>Sets a dictionary for the given object into the
  1234. internal data structure.</p>
  1235. </div>
  1236. <table class="params">
  1237. <tbody>
  1238. <tr>
  1239. <td class="name">
  1240. <strong translate="no">object</strong>
  1241. </td>
  1242. <td class="description last">
  1243. <p>The object.</p>
  1244. </td>
  1245. </tr>
  1246. <tr>
  1247. <td class="name">
  1248. <strong translate="no">value</strong>
  1249. </td>
  1250. <td class="description last">
  1251. <p>The dictionary to set.</p>
  1252. </td>
  1253. </tr>
  1254. </tbody>
  1255. </table>
  1256. </div>
  1257. <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> <span class="type-signature">(abstract) </span></h3>
  1258. <div class="method">
  1259. <div class="description">
  1260. <p>Defines the scissor test.</p>
  1261. </div>
  1262. <table class="params">
  1263. <tbody>
  1264. <tr>
  1265. <td class="name">
  1266. <strong translate="no">boolean</strong>
  1267. </td>
  1268. <td class="description last">
  1269. <p>Whether the scissor test should be enabled or not.</p>
  1270. </td>
  1271. </tr>
  1272. </tbody>
  1273. </table>
  1274. </div>
  1275. <h3 class="name name-method" id="setXRTarget" translate="no">.<a href="#setXRTarget">setXRTarget</a><span class="signature">( xrTarget : <span class="param-type">Object</span> )</span> </h3>
  1276. <div class="method">
  1277. <div class="description">
  1278. <p>Sets the XR rendering destination.</p>
  1279. <p>Backends that render directly into XR framebuffers can override this hook.</p>
  1280. </div>
  1281. <table class="params">
  1282. <tbody>
  1283. <tr>
  1284. <td class="name">
  1285. <strong translate="no">xrTarget</strong>
  1286. </td>
  1287. <td class="description last">
  1288. <p>The XR rendering destination.</p>
  1289. </td>
  1290. </tr>
  1291. </tbody>
  1292. </table>
  1293. </div>
  1294. <h3 class="name name-method" id="updateAttribute" translate="no">.<a href="#updateAttribute">updateAttribute</a><span class="signature">( attribute : <span class="param-type"><a href="BufferAttribute.html">BufferAttribute</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  1295. <div class="method">
  1296. <div class="description">
  1297. <p>Updates the GPU buffer of a shader attribute.</p>
  1298. </div>
  1299. <table class="params">
  1300. <tbody>
  1301. <tr>
  1302. <td class="name">
  1303. <strong translate="no">attribute</strong>
  1304. </td>
  1305. <td class="description last">
  1306. <p>The buffer attribute to update.</p>
  1307. </td>
  1308. </tr>
  1309. </tbody>
  1310. </table>
  1311. </div>
  1312. <h3 class="name name-method" id="updateBinding" translate="no">.<a href="#updateBinding">updateBinding</a><span class="signature">( binding : <span class="param-type"><a href="Buffer.html">Buffer</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  1313. <div class="method">
  1314. <div class="description">
  1315. <p>Updates a buffer binding.</p>
  1316. </div>
  1317. <table class="params">
  1318. <tbody>
  1319. <tr>
  1320. <td class="name">
  1321. <strong translate="no">binding</strong>
  1322. </td>
  1323. <td class="description last">
  1324. <p>The buffer binding to update.</p>
  1325. </td>
  1326. </tr>
  1327. </tbody>
  1328. </table>
  1329. </div>
  1330. <h3 class="name name-method" id="updateBindings" translate="no">.<a href="#updateBindings">updateBindings</a><span class="signature">( bindGroup : <span class="param-type"><a href="BindGroup.html">BindGroup</a></span>, bindings : <span class="param-type">Array.&lt;<a href="BindGroup.html">BindGroup</a>></span>, cacheIndex : <span class="param-type">number</span>, version : <span class="param-type">number</span> )</span> <span class="type-signature">(abstract) </span></h3>
  1331. <div class="method">
  1332. <div class="description">
  1333. <p>Updates the given bind group definition.</p>
  1334. </div>
  1335. <table class="params">
  1336. <tbody>
  1337. <tr>
  1338. <td class="name">
  1339. <strong translate="no">bindGroup</strong>
  1340. </td>
  1341. <td class="description last">
  1342. <p>The bind group.</p>
  1343. </td>
  1344. </tr>
  1345. <tr>
  1346. <td class="name">
  1347. <strong translate="no">bindings</strong>
  1348. </td>
  1349. <td class="description last">
  1350. <p>Array of bind groups.</p>
  1351. </td>
  1352. </tr>
  1353. <tr>
  1354. <td class="name">
  1355. <strong translate="no">cacheIndex</strong>
  1356. </td>
  1357. <td class="description last">
  1358. <p>The cache index.</p>
  1359. </td>
  1360. </tr>
  1361. <tr>
  1362. <td class="name">
  1363. <strong translate="no">version</strong>
  1364. </td>
  1365. <td class="description last">
  1366. <p>The version.</p>
  1367. </td>
  1368. </tr>
  1369. </tbody>
  1370. </table>
  1371. </div>
  1372. <h3 class="name name-method" id="updateSampler" translate="no">.<a href="#updateSampler">updateSampler</a><span class="signature">( binding : <span class="param-type"><a href="Sampler.html">Sampler</a></span> )</span><span class="type-signature"> : string</span> <span class="type-signature">(abstract) </span></h3>
  1373. <div class="method">
  1374. <div class="description">
  1375. <p>Updates a GPU sampler for the given texture.</p>
  1376. </div>
  1377. <table class="params">
  1378. <tbody>
  1379. <tr>
  1380. <td class="name">
  1381. <strong translate="no">binding</strong>
  1382. </td>
  1383. <td class="description last">
  1384. <p>The sampler binding to update.</p>
  1385. </td>
  1386. </tr>
  1387. </tbody>
  1388. </table>
  1389. <dl class="details">
  1390. <dt class="tag-returns"><strong>Returns:</strong> The current sampler key.</dt>
  1391. </dl>
  1392. </div>
  1393. <h3 class="name name-method" id="updateSize" translate="no">.<a href="#updateSize">updateSize</a><span class="signature">()</span> <span class="type-signature">(abstract) </span></h3>
  1394. <div class="method">
  1395. <div class="description">
  1396. <p>Backends can use this method if they have to run
  1397. logic when the renderer gets resized.</p>
  1398. </div>
  1399. </div>
  1400. <h3 class="name name-method" id="updateTexture" translate="no">.<a href="#updateTexture">updateTexture</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, options : <span class="param-type">Object</span> )</span> <span class="type-signature">(abstract) </span></h3>
  1401. <div class="method">
  1402. <div class="description">
  1403. <p>Uploads the updated texture data to the GPU.</p>
  1404. </div>
  1405. <table class="params">
  1406. <tbody>
  1407. <tr>
  1408. <td class="name">
  1409. <strong translate="no">texture</strong>
  1410. </td>
  1411. <td class="description last">
  1412. <p>The texture.</p>
  1413. </td>
  1414. </tr>
  1415. <tr>
  1416. <td class="name">
  1417. <strong translate="no">options</strong>
  1418. </td>
  1419. <td class="description last">
  1420. <p>Optional configuration parameter.</p>
  1421. <p>Default is <code>{}</code>.</p>
  1422. </td>
  1423. </tr>
  1424. </tbody>
  1425. </table>
  1426. </div>
  1427. <h3 class="name name-method" id="updateTimeStampUID" translate="no">.<a href="#updateTimeStampUID">updateTimeStampUID</a><span class="signature">( abstractRenderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a> | <a href="ComputeNode.html">ComputeNode</a></span> )</span> </h3>
  1428. <div class="method">
  1429. <div class="description">
  1430. <p>Updates a unique identifier for the given render context that can be used
  1431. to allocate resources like occlusion queries or timestamp queries.</p>
  1432. </div>
  1433. <table class="params">
  1434. <tbody>
  1435. <tr>
  1436. <td class="name">
  1437. <strong translate="no">abstractRenderContext</strong>
  1438. </td>
  1439. <td class="description last">
  1440. <p>The render context.</p>
  1441. </td>
  1442. </tr>
  1443. </tbody>
  1444. </table>
  1445. </div>
  1446. <h3 class="name name-method" id="updateViewport" translate="no">.<a href="#updateViewport">updateViewport</a><span class="signature">( renderContext : <span class="param-type"><a href="RenderContext.html">RenderContext</a></span> )</span> <span class="type-signature">(abstract) </span></h3>
  1447. <div class="method">
  1448. <div class="description">
  1449. <p>Updates the viewport with the values from the given render context.</p>
  1450. </div>
  1451. <table class="params">
  1452. <tbody>
  1453. <tr>
  1454. <td class="name">
  1455. <strong translate="no">renderContext</strong>
  1456. </td>
  1457. <td class="description last">
  1458. <p>The render context.</p>
  1459. </td>
  1460. </tr>
  1461. </tbody>
  1462. </table>
  1463. </div>
  1464. <h2 class="subsection-title">Source</h2>
  1465. <p>
  1466. <a href="https://github.com/mrdoob/three.js/blob/master/src/renderers/common/Backend.js" translate="no" target="_blank" rel="noopener">src/renderers/common/Backend.js</a>
  1467. </p>
  1468. </article>
  1469. </section>
  1470. <script src="../scripts/linenumber.js"></script>
  1471. <script src="../scripts/page.js"></script>
  1472. </body>
  1473. </html>
粤ICP备19079148号