VideoTexture.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>VideoTexture - 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> → </p>
  13. <h1 translate="no">VideoTexture</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A texture for use with a video.</p>
  17. <p>Note: When using video textures with <a href="WebGPURenderer.html">WebGPURenderer</a>, <a href="Texture.html#colorSpace">Texture#colorSpace</a> must be
  18. set to THREE.SRGBColorSpace.</p>
  19. <p>Note: After the initial use of a texture, its dimensions, format, and type
  20. cannot be changed. Instead, call <a href="Texture.html#dispose">Texture#dispose</a> on the texture and instantiate a new one.</p></div>
  21. <h2>Code Example</h2>
  22. <div translate="no"><pre><code class="language-js">// assuming you have created a HTML video element with id=&quot;video&quot;
  23. const video = document.getElementById( 'video' );
  24. const texture = new THREE.VideoTexture( video );
  25. </code></pre></div>
  26. </header>
  27. <article>
  28. <div class="container-overview">
  29. <h2>Constructor</h2>
  30. <h3 class="name name-method" id="VideoTexture" translate="no">new <a href="#VideoTexture">VideoTexture</a><span class="signature">( video : <span class="param-type">HTMLVideoElement</span>, 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>
  31. <div class="method">
  32. <div class="description">
  33. <p>Constructs a new video texture.</p>
  34. </div>
  35. <table class="params">
  36. <tbody>
  37. <tr>
  38. <td class="name">
  39. <strong>video</strong>
  40. </td>
  41. <td class="description last">
  42. <p>The video element to use as a data source for the texture.</p>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td class="name">
  47. <strong>mapping</strong>
  48. </td>
  49. <td class="description last">
  50. <p>The texture mapping.</p>
  51. <p>Default is <code>Texture.DEFAULT_MAPPING</code>.</p>
  52. </td>
  53. </tr>
  54. <tr>
  55. <td class="name">
  56. <strong>wrapS</strong>
  57. </td>
  58. <td class="description last">
  59. <p>The wrapS value.</p>
  60. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td class="name">
  65. <strong>wrapT</strong>
  66. </td>
  67. <td class="description last">
  68. <p>The wrapT value.</p>
  69. <p>Default is <code>ClampToEdgeWrapping</code>.</p>
  70. </td>
  71. </tr>
  72. <tr>
  73. <td class="name">
  74. <strong>magFilter</strong>
  75. </td>
  76. <td class="description last">
  77. <p>The mag filter value.</p>
  78. <p>Default is <code>LinearFilter</code>.</p>
  79. </td>
  80. </tr>
  81. <tr>
  82. <td class="name">
  83. <strong>minFilter</strong>
  84. </td>
  85. <td class="description last">
  86. <p>The min filter value.</p>
  87. <p>Default is <code>LinearFilter</code>.</p>
  88. </td>
  89. </tr>
  90. <tr>
  91. <td class="name">
  92. <strong>format</strong>
  93. </td>
  94. <td class="description last">
  95. <p>The texture format.</p>
  96. <p>Default is <code>RGBAFormat</code>.</p>
  97. </td>
  98. </tr>
  99. <tr>
  100. <td class="name">
  101. <strong>type</strong>
  102. </td>
  103. <td class="description last">
  104. <p>The texture type.</p>
  105. <p>Default is <code>UnsignedByteType</code>.</p>
  106. </td>
  107. </tr>
  108. <tr>
  109. <td class="name">
  110. <strong>anisotropy</strong>
  111. </td>
  112. <td class="description last">
  113. <p>The anisotropy value.</p>
  114. <p>Default is <code>Texture.DEFAULT_ANISOTROPY</code>.</p>
  115. </td>
  116. </tr>
  117. </tbody>
  118. </table>
  119. </div>
  120. </div>
  121. <h2 class="subsection-title">Properties</h2>
  122. <div class="member">
  123. <h3 class="name" id="generateMipmaps" translate="no">.<a href="#generateMipmaps">generateMipmaps</a><span class="type-signature"> : boolean</span> </h3>
  124. <div class="description">
  125. <p>Whether to generate mipmaps (if possible) for a texture.</p>
  126. <p>Overwritten and set to <code>false</code> by default.</p>
  127. <p>Default is <code>false</code>.</p>
  128. </div>
  129. <dl class="details">
  130. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Texture.html#generateMipmaps">Texture#generateMipmaps</a></dt>
  131. </dl>
  132. </div>
  133. <div class="member">
  134. <h3 class="name" id="isVideoTexture" translate="no">.<a href="#isVideoTexture">isVideoTexture</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  135. <div class="description">
  136. <p>This flag can be used for type testing.</p>
  137. <p>Default is <code>true</code>.</p>
  138. </div>
  139. </div>
  140. <h2 class="subsection-title">Methods</h2>
  141. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  142. <div class="method">
  143. <div class="description">
  144. <p>This method is called automatically by the renderer and sets <a href="Texture.html#needsUpdate">Texture#needsUpdate</a>
  145. to <code>true</code> every time a new frame is available.</p>
  146. <p>Only relevant if <code>requestVideoFrameCallback</code> is not supported in the browser.</p>
  147. </div>
  148. </div>
  149. <h2 class="subsection-title">Source</h2>
  150. <p>
  151. <a href="https://github.com/mrdoob/three.js/blob/master/src/textures/VideoTexture.js" translate="no" target="_blank" rel="noopener">src/textures/VideoTexture.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号