KTXLoader.html 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>KTXLoader - 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="Loader.html">Loader</a> → <a href="CompressedTextureLoader.html">CompressedTextureLoader</a> → </p>
  13. <h1 translate="no">KTXLoader</h1>
  14. <section>
  15. <header>
  16. <div class="class-description"><p>A loader for the KTX texture compression format.</p>
  17. <p>References:</p>
  18. <ul>
  19. <li><a href="https://www.khronos.org/opengles/sdk/tools/KTX/" target="_blank" rel="noopener">The KTX File Format and Tools</a></li>
  20. <li><a href="https://github.com/BabylonJS/Babylon.js/blob/master/src/Misc/khronosTextureContainer.ts" target="_blank" rel="noopener">Babylon.JS khronosTextureContainer.ts</a></li>
  21. </ul></div>
  22. <h2>Code Example</h2>
  23. <div translate="no"><pre><code class="language-js">const loader = new KTXLoader();
  24. const map = loader.load( 'textures/compressed/lensflare_ASTC8x8.ktx' )
  25. map.colorSpace = THREE.SRGBColorSpace; // only for color textures
  26. </code></pre></div>
  27. </header>
  28. <article>
  29. <h2 class="subsection-title">Import</h2>
  30. <p><span translate="no">KTXLoader</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
  31. <pre><code class="language-js">import { KTXLoader } from 'three/addons/loaders/KTXLoader.js';</code></pre>
  32. <div class="container-overview">
  33. <h2>Constructor</h2>
  34. <h3 class="name name-method" id="KTXLoader" translate="no">new <a href="#KTXLoader">KTXLoader</a><span class="signature">( manager : <span class="param-type"><a href="LoadingManager.html">LoadingManager</a></span> )</span> </h3>
  35. <div class="method">
  36. <div class="description">
  37. <p>Constructs a new KTX loader.</p>
  38. </div>
  39. <table class="params">
  40. <tbody>
  41. <tr>
  42. <td class="name">
  43. <strong>manager</strong>
  44. </td>
  45. <td class="description last">
  46. <p>The loading manager.</p>
  47. </td>
  48. </tr>
  49. </tbody>
  50. </table>
  51. </div>
  52. </div>
  53. <h2 class="subsection-title">Methods</h2>
  54. <h3 class="name name-method" id="parse" translate="no">.<a href="#parse">parse</a><span class="signature">( buffer : <span class="param-type">ArrayBuffer</span>, loadMipmaps : <span class="param-type">boolean</span> )</span><span class="type-signature"> : <a href="CompressedTextureLoader.html#~TexData">CompressedTextureLoader~TexData</a></span> </h3>
  55. <div class="method">
  56. <div class="description">
  57. <p>Parses the given KTX texture data.</p>
  58. </div>
  59. <table class="params">
  60. <tbody>
  61. <tr>
  62. <td class="name">
  63. <strong>buffer</strong>
  64. </td>
  65. <td class="description last">
  66. <p>The raw texture data.</p>
  67. </td>
  68. </tr>
  69. <tr>
  70. <td class="name">
  71. <strong>loadMipmaps</strong>
  72. </td>
  73. <td class="description last">
  74. <p>Whether to load mipmaps or not.</p>
  75. </td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. <dl class="details">
  80. <dt class="tag-overrides"><strong>Overrides:</strong> <a href="CompressedTextureLoader.html#parse">CompressedTextureLoader#parse</a></dt>
  81. </dl>
  82. <dl class="details">
  83. <dt class="tag-returns"><strong>Returns:</strong> An object representing the parsed texture data.</dt>
  84. </dl>
  85. </div>
  86. <h2 class="subsection-title">Source</h2>
  87. <p>
  88. <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/loaders/KTXLoader.js" translate="no" target="_blank" rel="noopener">examples/jsm/loaders/KTXLoader.js</a>
  89. </p>
  90. </article>
  91. </section>
  92. <script src="../scripts/linenumber.js"></script>
  93. <script src="../scripts/page.js"></script>
  94. </body>
  95. </html>
粤ICP备19079148号