VideoTexture.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Texture] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">Creates a texture for use with a video.</p>
  13. <p>
  14. Note: After the initial use of a texture, the video cannot be changed.
  15. Instead, call [page:.dispose]() on the texture and instantiate a new one.
  16. </p>
  17. <h2>Code Example</h2>
  18. <code>
  19. // assuming you have created a HTML video element with id="video"
  20. const video = document.getElementById( 'video' );
  21. const texture = new THREE.VideoTexture( video );
  22. </code>
  23. <h2>Examples</h2>
  24. <p>
  25. [example:webgl_materials_video materials / video]<br />
  26. [example:webgl_materials_video_webcam materials / video / webcam]<br />
  27. [example:webgl_video_kinect video / kinect]<br />
  28. [example:webgl_video_panorama_equirectangular video / panorama / equirectangular]<br />
  29. [example:webxr_vr_video vr / video]
  30. </p>
  31. <h2>Constructor</h2>
  32. <h3>
  33. [name]( [param:Video video], [param:Constant mapping], [param:Constant wrapS],
  34. [param:Constant wrapT], [param:Constant magFilter], [param:Constant minFilter],
  35. [param:Constant format], [param:Constant type], [param:Number anisotropy] )
  36. </h3>
  37. <p>
  38. [page:Video video] -- The video element to use as the texture. <br />
  39. [page:Constant mapping] -- How the image is applied to the object. An
  40. object type of [page:Textures THREE.UVMapping].
  41. See [page:Textures mapping constants] for other choices.<br />
  42. [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  43. See [page:Textures wrap mode constants] for
  44. other choices.<br />
  45. [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  46. See [page:Textures wrap mode constants] for
  47. other choices.<br />
  48. [page:Constant magFilter] -- How the texture is sampled when a texel
  49. covers more than one pixel. The default is [page:Textures THREE.LinearFilter].
  50. See [page:Textures magnification filter constants]
  51. for other choices.<br />
  52. [page:Constant minFilter] -- How the texture is sampled when a texel
  53. covers less than one pixel. The default is [page:Textures THREE.LinearFilter].
  54. See [page:Textures minification filter constants] for
  55. other choices.<br />
  56. [page:Constant format] -- The default is [page:Textures THREE.RGBAFormat].
  57. See [page:Textures format constants] for other choices.<br />
  58. [page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType].
  59. See [page:Textures type constants] for other choices.<br />
  60. [page:Number anisotropy] -- The number of samples taken along the axis
  61. through the pixel that has the highest density of texels. By default, this
  62. value is `1`. A higher value gives a less blurry result than a basic mipmap,
  63. at the cost of more texture samples being used. Use
  64. [page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to find
  65. the maximum valid anisotropy value for the GPU; this value is usually a
  66. power of 2.<br /><br />
  67. </p>
  68. <h2>Properties</h2>
  69. <p>See the base [page:Texture Texture] class for common properties.</p>
  70. <h3>[property:Boolean generateMipmaps]</h3>
  71. <p>Whether to generate mipmaps. `false` by default.</p>
  72. <h3>[property:Boolean isVideoTexture]</h3>
  73. <p>Read-only flag to check if a given object is of type [name].</p>
  74. <h3>[property:Boolean needsUpdate]</h3>
  75. <p>
  76. You will not need to set this manually here as it is handled by the
  77. [page:VideoTexture.update update]() method.
  78. </p>
  79. <h2>Methods</h2>
  80. <p>See the base [page:Texture Texture] class for common methods.</p>
  81. <h3>[method:undefined update]()</h3>
  82. <p>
  83. This is called automatically and sets [page:VideoTexture.needsUpdate .needsUpdate]
  84. to `true` every time a new frame is available.
  85. </p>
  86. <h2>Source</h2>
  87. <p>
  88. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  89. </p>
  90. </body>
  91. </html>