TextureUtils.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>TextureUtils - 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. <h1 translate="no">TextureUtils</h1>
  13. <section>
  14. <header>
  15. <div class="class-description"><p>A class containing utility functions for textures.</p></div>
  16. </header>
  17. <article>
  18. <div class="container-overview">
  19. <div class="method">
  20. </div>
  21. </div>
  22. <h2 class="subsection-title">Static Methods</h2>
  23. <h3 class="name name-method" id=".contain" translate="no">.<a href="#.contain">contain</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, aspect : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  24. <div class="method">
  25. <div class="description">
  26. <p>Scales the texture as large as possible within its surface without cropping
  27. or stretching the texture. The method preserves the original aspect ratio of
  28. the texture. Akin to CSS <code>object-fit: contain</code></p>
  29. </div>
  30. <table class="params">
  31. <tbody>
  32. <tr>
  33. <td class="name">
  34. <strong>texture</strong>
  35. </td>
  36. <td class="description last">
  37. <p>The texture.</p>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td class="name">
  42. <strong>aspect</strong>
  43. </td>
  44. <td class="description last">
  45. <p>The texture's aspect ratio.</p>
  46. </td>
  47. </tr>
  48. </tbody>
  49. </table>
  50. <dl class="details">
  51. <dt class="tag-returns"><strong>Returns:</strong> The updated texture.</dt>
  52. </dl>
  53. </div>
  54. <h3 class="name name-method" id=".cover" translate="no">.<a href="#.cover">cover</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span>, aspect : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  55. <div class="method">
  56. <div class="description">
  57. <p>Scales the texture to the smallest possible size to fill the surface, leaving
  58. no empty space. The method preserves the original aspect ratio of the texture.
  59. Akin to CSS <code>object-fit: cover</code>.</p>
  60. </div>
  61. <table class="params">
  62. <tbody>
  63. <tr>
  64. <td class="name">
  65. <strong>texture</strong>
  66. </td>
  67. <td class="description last">
  68. <p>The texture.</p>
  69. </td>
  70. </tr>
  71. <tr>
  72. <td class="name">
  73. <strong>aspect</strong>
  74. </td>
  75. <td class="description last">
  76. <p>The texture's aspect ratio.</p>
  77. </td>
  78. </tr>
  79. </tbody>
  80. </table>
  81. <dl class="details">
  82. <dt class="tag-returns"><strong>Returns:</strong> The updated texture.</dt>
  83. </dl>
  84. </div>
  85. <h3 class="name name-method" id=".fill" translate="no">.<a href="#.fill">fill</a><span class="signature">( texture : <span class="param-type"><a href="Texture.html">Texture</a></span> )</span><span class="type-signature"> : <a href="Texture.html">Texture</a></span> </h3>
  86. <div class="method">
  87. <div class="description">
  88. <p>Configures the texture to the default transformation. Akin to CSS <code>object-fit: fill</code>.</p>
  89. </div>
  90. <table class="params">
  91. <tbody>
  92. <tr>
  93. <td class="name">
  94. <strong>texture</strong>
  95. </td>
  96. <td class="description last">
  97. <p>The texture.</p>
  98. </td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <dl class="details">
  103. <dt class="tag-returns"><strong>Returns:</strong> The updated texture.</dt>
  104. </dl>
  105. </div>
  106. <h3 class="name name-method" id=".getByteLength" translate="no">.<a href="#.getByteLength">getByteLength</a><span class="signature">( width : <span class="param-type">number</span>, height : <span class="param-type">number</span>, format : <span class="param-type">number</span>, type : <span class="param-type">number</span> )</span><span class="type-signature"> : number</span> </h3>
  107. <div class="method">
  108. <div class="description">
  109. <p>Determines how many bytes must be used to represent the texture.</p>
  110. </div>
  111. <table class="params">
  112. <tbody>
  113. <tr>
  114. <td class="name">
  115. <strong>width</strong>
  116. </td>
  117. <td class="description last">
  118. <p>The width of the texture.</p>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td class="name">
  123. <strong>height</strong>
  124. </td>
  125. <td class="description last">
  126. <p>The height of the texture.</p>
  127. </td>
  128. </tr>
  129. <tr>
  130. <td class="name">
  131. <strong>format</strong>
  132. </td>
  133. <td class="description last">
  134. <p>The texture's format.</p>
  135. </td>
  136. </tr>
  137. <tr>
  138. <td class="name">
  139. <strong>type</strong>
  140. </td>
  141. <td class="description last">
  142. <p>The texture's type.</p>
  143. </td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. <dl class="details">
  148. <dt class="tag-returns"><strong>Returns:</strong> The byte length.</dt>
  149. </dl>
  150. </div>
  151. <h2 class="subsection-title">Source</h2>
  152. <p>
  153. <a href="https://github.com/mrdoob/three.js/blob/master/src/extras/TextureUtils.js" translate="no" target="_blank" rel="noopener">src/extras/TextureUtils.js</a>
  154. </p>
  155. </article>
  156. </section>
  157. <script src="../scripts/linenumber.js"></script>
  158. <script src="../scripts/page.js"></script>
  159. </body>
  160. </html>
粤ICP备19079148号