FramebufferTexture.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>FramebufferTexture - Three.js Docs</title>
  6. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  7. <script src="../scripts/highlight.min.js"></script>
  8. <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
  9. <link type="text/css" rel="stylesheet" href="../styles/page.css">
  10. </head>
  11. <body>
  12. <p class="inheritance" translate="no"><a href="EventDispatcher.html">EventDispatcher</a> → <a href="Texture.html">Texture</a> → </p>
  13. <h1 translate="no">FramebufferTexture</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>This class can only be used in combination with <code>copyFramebufferToTexture()</code> methods
  17. of renderers. It extracts the contents of the current bound framebuffer and provides it
  18. as a texture for further usage.</p></div>
  19. <h2>Code Example</h2>
  20. <div translate="no"><pre><code class="language-js">const pixelRatio = window.devicePixelRatio;
  21. const textureSize = 128 * pixelRatio;
  22. const frameTexture = new FramebufferTexture( textureSize, textureSize );
  23. // calculate start position for copying part of the frame data
  24. const vector = new Vector2();
  25. vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );
  26. vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );
  27. renderer.render( scene, camera );
  28. // copy part of the rendered frame into the framebuffer texture
  29. renderer.copyFramebufferToTexture( frameTexture, vector );
  30. </code></pre></div>
  31. </header>
  32. <article>
  33. <div class="container-overview">
  34. <h2>Constructor</h2>
  35. <h3 class="name name-method" id="FramebufferTexture" translate="no">new <a href="#FramebufferTexture">FramebufferTexture</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span> )</span> </h3>
  36. <div class="method">
  37. <div class="description">
  38. <p>Constructs a new framebuffer texture.</p>
  39. </div>
  40. <table class="params">
  41. <tbody>
  42. <tr>
  43. <td class="name">
  44. <strong>width</strong>
  45. </td>
  46. <td class="description last">
  47. <p>The width of the texture.</p>
  48. </td>
  49. </tr>
  50. <tr>
  51. <td class="name">
  52. <strong>height</strong>
  53. </td>
  54. <td class="description last">
  55. <p>The height of the texture.</p>
  56. </td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. </div>
  61. </div>
  62. <h2 class="subsection-title">Properties</h2>
  63. <div class="member">
  64. <h3 class="name" id="generateMipmaps" translate="no">.<a href="#generateMipmaps">generateMipmaps</a><span class="type-signature"> : boolean</span> </h3>
  65. <div class="description">
  66. <p>Whether to generate mipmaps (if possible) for a texture.</p>
  67. <p>Overwritten and set to <code>false</code> by default.</p>
  68. <p>Default is <code>false</code>.</p>
  69. </div>
  70. <dl class="details">
  71. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Texture.html#generateMipmaps">Texture#generateMipmaps</a></dt>
  72. </dl>
  73. </div>
  74. <div class="member">
  75. <h3 class="name" id="isFramebufferTexture" translate="no">.<a href="#isFramebufferTexture">isFramebufferTexture</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
  76. <div class="description">
  77. <p>This flag can be used for type testing.</p>
  78. <p>Default is <code>true</code>.</p>
  79. </div>
  80. </div>
  81. <div class="member">
  82. <h3 class="name" id="magFilter" translate="no">.<a href="#magFilter">magFilter</a><span class="type-signature"> : <a href="global.html#NearestFilter">NearestFilter</a> | <a href="global.html#NearestMipmapNearestFilter">NearestMipmapNearestFilter</a> | <a href="global.html#NearestMipmapLinearFilter">NearestMipmapLinearFilter</a> | <a href="global.html#LinearFilter">LinearFilter</a> | <a href="global.html#LinearMipmapNearestFilter">LinearMipmapNearestFilter</a> | <a href="global.html#LinearMipmapLinearFilter">LinearMipmapLinearFilter</a></span> </h3>
  83. <div class="description">
  84. <p>How the texture is sampled when a texel covers more than one pixel.</p>
  85. <p>Overwritten and set to <code>NearestFilter</code> by default to disable filtering.</p>
  86. <p>Default is <code>NearestFilter</code>.</p>
  87. </div>
  88. <dl class="details">
  89. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Texture.html#magFilter">Texture#magFilter</a></dt>
  90. </dl>
  91. </div>
  92. <div class="member">
  93. <h3 class="name" id="minFilter" translate="no">.<a href="#minFilter">minFilter</a><span class="type-signature"> : <a href="global.html#NearestFilter">NearestFilter</a> | <a href="global.html#NearestMipmapNearestFilter">NearestMipmapNearestFilter</a> | <a href="global.html#NearestMipmapLinearFilter">NearestMipmapLinearFilter</a> | <a href="global.html#LinearFilter">LinearFilter</a> | <a href="global.html#LinearMipmapNearestFilter">LinearMipmapNearestFilter</a> | <a href="global.html#LinearMipmapLinearFilter">LinearMipmapLinearFilter</a></span> </h3>
  94. <div class="description">
  95. <p>How the texture is sampled when a texel covers less than one pixel.</p>
  96. <p>Overwritten and set to <code>NearestFilter</code> by default to disable filtering.</p>
  97. <p>Default is <code>NearestFilter</code>.</p>
  98. </div>
  99. <dl class="details">
  100. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="Texture.html#minFilter">Texture#minFilter</a></dt>
  101. </dl>
  102. </div>
  103. <h2 class="subsection-title">Source</h2>
  104. <p>
  105. <a href="https://github.com/mrdoob/three.js/blob/master/src/textures/FramebufferTexture.js" translate="no" target="_blank" rel="noopener">src/textures/FramebufferTexture.js</a>
  106. </p>
  107. </article>
  108. </section>
  109. <script src="../scripts/linenumber.js"></script>
  110. <script src="../scripts/page.js"></script>
  111. </body>
  112. </html>
粤ICP备19079148号