VideoTexture.html 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="list.js"></script>
  7. <script src="page.js"></script>
  8. <link type="text/css" rel="stylesheet" href="page.css" />
  9. </head>
  10. <body>
  11. [page:Texture] &rarr;
  12. <h1>[name]</h1>
  13. <p class="desc">
  14. Creates a texture for use with a video texture.<br /><br />
  15. This is almost the same as the base [page:Texture Texture] class, except that it continuosly sets [page:Texture.needsUpdate needsUpdate] to *true* so that the texture is updated as the video plays. Automatic creation of [page:Texture.mipmaps mipmaps] is also disabled.
  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>[example:webgl_materials_video materials / video ]</p>
  25. <h2>Constructor</h2>
  26. <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>
  27. <p>
  28. [page:Video video] -- The video element to use as the texture. <br />
  29. [page:Constant mapping] -- How the image is applied to the object. An object type of [page:Textures THREE.UVMapping].
  30. See [page:Textures mapping constants] for other choices.<br />
  31. [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  32. See [page:Textures wrap mode constants] for other choices.<br />
  33. [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  34. See [page:Textures wrap mode constants] for other choices.<br />
  35. [page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel.
  36. The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.<br />
  37. [page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel.
  38. The default is [page:Textures THREE.LinearMipmapLinearFilter]. See [page:Textures minification filter constants] for other choices.<br />
  39. [page:Constant format] -- The format used in the texture.
  40. See [page:Textures format constants] for other choices.<br />
  41. [page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType].
  42. See [page:Textures type constants] for other choices.<br />
  43. [page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels.
  44. 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.
  45. 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 />
  46. </p>
  47. <h2>Properties</h2>
  48. <p>
  49. See the base [page:Texture Texture] class for common properties.
  50. </p>
  51. <h3>[property:boolean needsUpdate]</h3>
  52. <p>
  53. You will not need to set this manually here as it is handled by the [page:VideoTexture.update update] method.
  54. </p>
  55. <h2>Methods</h2>
  56. <p>
  57. See the base [page:Texture Texture] class for common methods.
  58. </p>
  59. <h3>[method:null update]()</h3>
  60. <p>
  61. This is called automatically and sets [property:boolean needsUpdate] to *true* every time
  62. a new frame is available.
  63. </p>
  64. <h2>Source</h2>
  65. <p>
  66. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  67. </p>
  68. </body>
  69. </html>