VideoTexture.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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"><code>video</code></td>
  39. <td class="description last"><p>The video element to use as a data source for the texture.</p></td>
  40. </tr>
  41. <tr>
  42. <td class="name"><code>mapping</code></td>
  43. <td class="description last"><p>The texture mapping.<br/>Default is <code>Texture.DEFAULT_MAPPING</code>.</p></td>
  44. </tr>
  45. <tr>
  46. <td class="name"><code>wrapS</code></td>
  47. <td class="description last"><p>The wrapS value.<br/>Default is <code>ClampToEdgeWrapping</code>.</p></td>
  48. </tr>
  49. <tr>
  50. <td class="name"><code>wrapT</code></td>
  51. <td class="description last"><p>The wrapT value.<br/>Default is <code>ClampToEdgeWrapping</code>.</p></td>
  52. </tr>
  53. <tr>
  54. <td class="name"><code>magFilter</code></td>
  55. <td class="description last"><p>The mag filter value.<br/>Default is <code>LinearFilter</code>.</p></td>
  56. </tr>
  57. <tr>
  58. <td class="name"><code>minFilter</code></td>
  59. <td class="description last"><p>The min filter value.<br/>Default is <code>LinearFilter</code>.</p></td>
  60. </tr>
  61. <tr>
  62. <td class="name"><code>format</code></td>
  63. <td class="description last"><p>The texture format.<br/>Default is <code>RGBAFormat</code>.</p></td>
  64. </tr>
  65. <tr>
  66. <td class="name"><code>type</code></td>
  67. <td class="description last"><p>The texture type.<br/>Default is <code>UnsignedByteType</code>.</p></td>
  68. </tr>
  69. <tr>
  70. <td class="name"><code>anisotropy</code></td>
  71. <td class="description last"><p>The anisotropy value.<br/>Default is <code>Texture.DEFAULT_ANISOTROPY</code>.</p></td>
  72. </tr>
  73. </tbody>
  74. </table>
  75. </div>
  76. </div>
  77. <h2 class="subsection-title">Properties</h2>
  78. <div class="member">
  79. <h3 class="name" id="generateMipmaps" translate="no">.<a href="#generateMipmaps">generateMipmaps</a><span class="type-signature"> : boolean</span> </h3>
  80. <div class="description">
  81. <p>Whether to generate mipmaps (if possible) for a texture.</p>
  82. <p>Overwritten and set to <code>false</code> by default.<br/>Default is <code>false</code>.</p>
  83. </div>
  84. <dl class="details">
  85. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Texture.html#generateMipmaps">Texture#generateMipmaps</a></dt>
  86. </dl>
  87. </div>
  88. <div class="member">
  89. <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>
  90. <div class="description">
  91. <p>This flag can be used for type testing.<br/>Default is <code>true</code>.</p>
  92. </div>
  93. </div>
  94. <h2 class="subsection-title">Methods</h2>
  95. <h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">()</span> </h3>
  96. <div class="method">
  97. <div class="description">
  98. <p>This method is called automatically by the renderer and sets <a href="Texture.html#needsUpdate">Texture#needsUpdate</a>
  99. to <code>true</code> every time a new frame is available.</p>
  100. <p>Only relevant if <code>requestVideoFrameCallback</code> is not supported in the browser.</p>
  101. </div>
  102. </div>
  103. <h2 class="subsection-title">Source</h2>
  104. <p>
  105. <a href="https://github.com/mrdoob/three.js/blob/master/src/textures/VideoTexture.js" target="_blank" rel="noopener" translate="no">src/textures/VideoTexture.js</a>
  106. </p>
  107. </article>
  108. </section>
  109. <script src="../scripts/linenumber.js"></script>
  110. <script src="../scripts/page.js"></script>
  111. </body>
  112. </html>
粤ICP备19079148号