VideoFrameTexture.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>VideoFrameTexture - 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. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Texture.html">Texture</a> → <a href="VideoTexture.html">VideoTexture</a> → </p>
  13. <h1 translate="no">VideoFrameTexture</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class can be used as an alternative way to define video data. Instead of using
  17. an instance of <code>HTMLVideoElement</code> like with <code>VideoTexture</code>, <code>VideoFrameTexture</code> expects each frame is
  18. defined manually via <a href="VideoFrameTexture.html#setFrame">VideoFrameTexture#setFrame</a>. A typical use case for this module is when
  19. video frames are decoded with the WebCodecs API.</p></div>
  20. <h2>Code Example</h2>
  21. <div translate="no"><pre><code class="language-js">const texture = new THREE.VideoFrameTexture();
  22. texture.setFrame( frame );
  23. </code></pre></div>
  24. </header>
  25. <article>
  26. <div class="container-overview">
  27. <h2>Constructor</h2>
  28. <h3 class="name name-method" id="VideoFrameTexture" translate="no">new <a href="#VideoFrameTexture">VideoFrameTexture</a><span class="signature">( mapping : <span class="param-type">number</span>, wrapS : <span class="param-type">number</span>, wrapT : <span class="param-type">number</span>, magFilter : <span class="param-type">number</span>, minFilter : <span class="param-type">number</span>, format : <span class="param-type">number</span>, type : <span class="param-type">number</span>, anisotropy : <span class="param-type">number</span> )</span> </h3>
  29. <div class="method">
  30. <div class="description">
  31. <p>Constructs a new video frame texture.</p>
  32. </div>
  33. <table class="params">
  34. <tbody>
  35. <tr>
  36. <td class="name">
  37. <strong>mapping</strong>
  38. </td>
  39. <td class="description last">
  40. <p>The texture mapping.</p>
  41. <p>Default is <code>Texture.DEFAULT_MAPPING</code>.</p>
  42. </td>
  43. </tr>
  44. <tr>
  45. <td class="name">
  46. <strong>wrapS</strong>
  47. </td>
  48. <td class="description last">
  49. <p>The wrapS value.</p>
  50. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td class="name">
  55. <strong>wrapT</strong>
  56. </td>
  57. <td class="description last">
  58. <p>The wrapT value.</p>
  59. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  60. </td>
  61. </tr>
  62. <tr>
  63. <td class="name">
  64. <strong>magFilter</strong>
  65. </td>
  66. <td class="description last">
  67. <p>The mag filter value.</p>
  68. <p>Default is <code>LinearFilter</code>.</p>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td class="name">
  73. <strong>minFilter</strong>
  74. </td>
  75. <td class="description last">
  76. <p>The min filter value.</p>
  77. <p>Default is <code>LinearFilter</code>.</p>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="name">
  82. <strong>format</strong>
  83. </td>
  84. <td class="description last">
  85. <p>The texture format.</p>
  86. <p>Default is <code>RGBAFormat</code>.</p>
  87. </td>
  88. </tr>
  89. <tr>
  90. <td class="name">
  91. <strong>type</strong>
  92. </td>
  93. <td class="description last">
  94. <p>The texture type.</p>
  95. <p>Default is <code>UnsignedByteType</code>.</p>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td class="name">
  100. <strong>anisotropy</strong>
  101. </td>
  102. <td class="description last">
  103. <p>The anisotropy value.</p>
  104. <p>Default is <code>Texture.DEFAULT_ANISOTROPY</code>.</p>
  105. </td>
  106. </tr>
  107. </tbody>
  108. </table>
  109. </div>
  110. </div>
  111. <h2 class="subsection-title">Properties</h2>
  112. <div class="member">
  113. <h3 class="name" id="isVideoFrameTexture" translate="no">.<a href="#isVideoFrameTexture">isVideoFrameTexture</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  114. <div class="description">
  115. <p>This flag can be used for type testing.</p>
  116. <p>Default is <code>true</code>.</p>
  117. </div>
  118. </div>
  119. <h2 class="subsection-title">Methods</h2>
  120. <h3 class="name name-method" id="setFrame" translate="no">.<a href="#setFrame">setFrame</a><span class="signature">( frame : <span class="param-type">VideoFrame</span> )</span> </h3>
  121. <div class="method">
  122. <div class="description">
  123. <p>Sets the current frame of the video. This will automatically update the texture
  124. so the data can be used for rendering.</p>
  125. </div>
  126. <table class="params">
  127. <tbody>
  128. <tr>
  129. <td class="name">
  130. <strong>frame</strong>
  131. </td>
  132. <td class="description last">
  133. <p>The video frame.</p>
  134. </td>
  135. </tr>
  136. </tbody>
  137. </table>
  138. </div>
  139. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  140. <div class="method">
  141. <div class="description">
  142. <p>This method overwritten with an empty implementation since
  143. this type of texture is updated via <code>setFrame()</code>.</p>
  144. </div>
  145. <dl class="details">
  146. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="VideoTexture.html#update">VideoTexture#update</a></dt>
  147. </dl>
  148. </div>
  149. <h2 class="subsection-title">Source</h2>
  150. <p>
  151. <a href="https://github.com/mrdoob/three.js/blob/master/src/textures/VideoFrameTexture.js" translate="no" target="_blank" rel="noopener">src/textures/VideoFrameTexture.js</a>
  152. </p>
  153. </article>
  154. </section>
  155. <script src="../scripts/linenumber.js"></script>
  156. <script src="../scripts/page.js"></script>
  157. </body>
  158. </html>
粤ICP备19079148号