FramebufferTexture.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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. 这个类只能与 [page:WebGLRenderer.copyFramebufferToTexture]() 结合使用。
  14. </p>
  15. <code>
  16. const pixelRatio = window.devicePixelRatio;
  17. const textureSize = 128 * pixelRatio;
  18. // instantiate a framebuffer texture
  19. const frameTexture = new FramebufferTexture( textureSize, textureSize );
  20. // calculate start position for copying part of the frame data
  21. const vector = new Vector2();
  22. vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );
  23. vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );
  24. // render the scene
  25. renderer.clear();
  26. renderer.render( scene, camera );
  27. // copy part of the rendered frame into the framebuffer texture
  28. renderer.copyFramebufferToTexture( frameTexture, vector );
  29. </code>
  30. <h2>例子</h2>
  31. <p>[example:webgl_framebuffer_texture]</p>
  32. <h2>构造函数</h2>
  33. <h3>[name]( [param:Number width], [param:Number height] )</h3>
  34. <p>
  35. [page:Number width] -- 纹理的宽度<br />
  36. [page:Number height] -- 纹理的高度<br /><br />
  37. </p>
  38. <h2>属性</h2>
  39. <p>共有属性请参见其基类 [page:Texture Texture] </p>
  40. <h3>[property:Boolean generateMipmaps]</h3>
  41. <p>是否为 [name] 生成 mipmaps ,默认为`false`</p>
  42. <h3>[property:Boolean isFramebufferTexture]</h3>
  43. <p>只读,检查给定对象是否为 [name] 类型</p>
  44. <h3>[property:number magFilter]</h3>
  45. <p>
  46. 纹理元素覆盖多个像素时如何对纹理进行采样。默认值为 [page:Textures THREE.NearestFilter] ,它使用最接近的纹理元素。
  47. <br /><br />
  48. 更多细节详见 [page:Textures texture constants]
  49. </p>
  50. <h3>[property:number minFilter]</h3>
  51. <p>
  52. 纹理元素覆盖少于一个像素时如何对纹理进行采样。默认值为 [page:Textures THREE.NearestFilter] ,它使用最近的纹理元素。
  53. <br /><br />
  54. 更多细节详见 [page:Textures texture constants]
  55. </p>
  56. <h3>[property:Boolean needsUpdate]</h3>
  57. <p>默认为 `true` ,这是加载 canvas 数据所必需的</p>
  58. <h2>方法</h2>
  59. <p>共有方法请参见其基类 [page:Texture Texture] </p>
  60. <h2>源代码</h2>
  61. <p>
  62. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  63. </p>
  64. </body>
  65. </html>