2
0

VideoTexture.html 3.9 KB

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