VideoTexture.html 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 texture.<br /><br />
  14. 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.
  15. </p>
  16. <h2>Code Example</h2>
  17. <code>
  18. // assuming you have created a HTML video element with id="video"
  19. const video = document.getElementById( 'video' );
  20. const texture = new THREE.VideoTexture( video );
  21. </code>
  22. <h2>Examples</h2>
  23. <p>[example:webgl_materials_video materials / video ]</p>
  24. <h2>Constructor</h2>
  25. <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>
  26. <p>
  27. [page:Video video] -- The video element to use as the texture. <br />
  28. [page:Constant mapping] -- How the image is applied to the object. An object type of [page:Textures THREE.UVMapping].
  29. See [page:Textures mapping constants] for other choices.<br />
  30. [page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  31. See [page:Textures wrap mode constants] for other choices.<br />
  32. [page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
  33. See [page:Textures wrap mode constants] for other choices.<br />
  34. [page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel.
  35. The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.<br />
  36. [page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel.
  37. The default is [page:Textures THREE.LinearMipmapLinearFilter]. See [page:Textures minification filter constants] for other choices.<br />
  38. [page:Constant format] -- The default is [page:Textures THREE.RGBFormat].
  39. See [page:Textures format constants] for other choices.
  40. Note that a bug has been reported with Firefox's WebGL implementation where use of [page:Textures THREE.RGBFormat] on a VideoTexture can result in a significant performance penalty, if you encounter this issue it is recommended to pass in [page:Textures THREE.RGBAFormat] instead.<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>