VideoTexture.html 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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. 创建一个使用视频来作为贴图的纹理对象。<br /><br />
  15. 它和其基类[page:Texture Texture]几乎是相同的,除了它总是将[page:Texture.needsUpdate needsUpdate]设置为*true*,以便使得贴图能够在视频播放时进行更新。自动创建[page:Texture.mipmaps mipmaps]也会被禁用。
  16. </p>
  17. <h2>代码示例</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>例子</h2>
  24. <p>[example:webgl_materials_video materials / video ]</p>
  25. <h2>构造函数</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] -- 将被作为纹理贴图来使用的Video元素。<br />
  29. [page:Constant mapping] -- 纹理贴图将被如何应用(映射)到物体上,它是[page:Textures THREE.UVMapping]中的对象类型。
  30. 请参阅[page:Textures mapping constants](映射模式常量)来了解其他选项。<br />
  31. [page:Constant wrapS] -- 默认值是[page:Textures THREE.ClampToEdgeWrapping].
  32. 请参阅[page:Textures wrap mode constants](包裹模式常量)来了解其他选项。<br />
  33. [page:Constant wrapT] -- 默认值是[page:Textures THREE.ClampToEdgeWrapping].
  34. 请参阅[page:Textures wrap mode constants](包裹模式常量)来了解其他选项。<br />
  35. [page:Constant magFilter] -- 当一个纹素覆盖大于一个像素时,贴图将如何采样。
  36. 其默认值为[page:Textures THREE.LinearFilter]。请参阅[page:Textures magnification filter constants](放大滤镜常量)来了解其它选项。<br />
  37. [page:Constant minFilter] -- 当一个纹素覆盖小于一个像素时,贴图将如何采样。
  38. 其默认值为[page:Textures THREE.LinearMipmapLinearFilter]。请参阅[page:Textures minification filter constants](缩小滤镜常量)来了解其它选项。<br />
  39. [page:Constant format] -- 在纹理贴图中使用的格式。
  40. 请参阅[page:Textures format constants](格式常量)来了解各个选项。<br />
  41. [page:Constant type] -- 默认值是[page:Textures THREE.UnsignedByteType].
  42. 请参阅[page:Textures type constants](类型常量)来了解其他选项。<br />
  43. [page:Number anisotropy] -- 沿着轴,通过具有最高纹素密度的像素的采样数。
  44. 默认情况下,这个值为1。设置一个较高的值将会比基本的mipmap产生更清晰的效果,代价是需要使用更多纹理样本。
  45. 使用[page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() 来查询GPU中各向异性的最大有效值;这个值通常是2的幂。<br /><br />
  46. </p>
  47. <h2>属性</h2>
  48. <p>
  49. 共有属性请参见其基类[page:Texture Texture]。
  50. </p>
  51. <h3>[property:boolean needsUpdate]</h3>
  52. <p>
  53. 在这里,你不必手动设置这个值,因为它是由[page:VideoTexture.update update]方法来进行控制的。
  54. </p>
  55. <h2>方法</h2>
  56. <p>
  57. 共有方法请参见其基类[page:Texture Texture]。
  58. </p>
  59. <h3>[method:null update]()</h3>
  60. <p>
  61. 在每一次新的一帧可用时,这个方法将被自动调用,
  62. 并将[property:boolean needsUpdate]设置为*true*。
  63. </p>
  64. <h2>源代码</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>