Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jailln committed Oct 9, 2023
1 parent 2875157 commit 6bedee6
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 10 deletions.
2 changes: 1 addition & 1 deletion itowns/dev/dist/itowns.js

Large diffs are not rendered by default.

104 changes: 95 additions & 9 deletions itowns/dev/docs/api/Parser/B3dmParser.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ <h3>

<div class="description">
<p>Enable Draco decoding for gltf.</p>
<p>The Draco library files are in folder itowns/examples/libs/draco/.
You must indicate this path when you want to enable Draco Decoding.
For more information on Draco, read /itowns/examples/libs/draco/README.md.</p>
</div>


Expand All @@ -79,8 +82,8 @@ <h4>Parameters</h4>
<code>path</code>


&mdash; <span><p>to draco library folder.
This library is mandatory to load b3dm with Draco compression.</p></span>
&mdash; <span><p>path to draco library folder.
This library is mandatory to load b3dm and gltf with Draco compression.</p></span>



Expand All @@ -90,10 +93,7 @@ <h4>Parameters</h4>
<code>config</code>


&mdash; <span><p>optional configuration for Draco compression.</p>
<p>The Draco library files are in folder itowns/examples/libs/draco/.
You are obliged to indicate this path when you want enable the Draco Decoding.</p>
<p>For more information on Draco, read file in /itowns/examples/libs/draco/README.md.</p></span>
&mdash; <span><p>optional configuration for Draco compression.</p></span>



Expand All @@ -114,9 +114,95 @@ <h4>Example</h4>



<pre class="prettyprint source lang-js"><code>// if you copied the folder from /itowns/examples/libs/draco/ to your root project,
// You could set path with './'.
itowns.enableDracoLoader('./');</code></pre>
<pre class="prettyprint source lang-js"><code>// if you copied /itowns/examples/libs/draco/ to the root folder of your project,you can set the path to './'.
itowns.enableDracoLoader('./');

</code></pre>




</div>

<hr/>



<div class="method">
<h3>
<span class="method-name">enableKtx2Loader</span>
(




path:
<span class="type">string</span>,

renderer:
<span class="type">THREE.WebGLRenderer</span>


)

</h3>



<div class="description">
<p>Enable KTX2 decoding for gltf. This library is mandatory to load b3dm and gltf with KTX2 compression.</p>
<p>The KTX2 library files are in folder itowns/examples/libs/basis/.
You must indicate this path when you want to enable KTX2 decoding.
For more information about KTX2, read /itowns/examples/libs/basis/README.md.</p>
</div>






<h4>Parameters</h4>


<ul class="params">

<li>
<code>path</code>


&mdash; <span><p>path to KTX2 library folder.</p></span>



</li>

<li>
<code>renderer</code>


&mdash; <span><p>the threejs renderer</p></span>



</li>

</ul>





<h4>Example</h4>




<caption>Enable ktx2 decoder</caption>



<pre class="prettyprint source lang-js"><code>// if you copied /itowns/examples/libs/draco/ to the root folder of your project,you can set the path to './'.
itowns.enableKtx2Loader('./', view.mainLoop.gfxEngine.renderer);</code></pre>



Expand Down
46 changes: 46 additions & 0 deletions itowns/dev/examples/libs/basis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Basis Universal GPU Texture Compression

Basis Universal is a "[supercompressed](http://gamma.cs.unc.edu/GST/gst.pdf)"
GPU texture and texture video compression system that outputs a highly
compressed intermediate file format (.basis) that can be quickly transcoded to
a wide variety of GPU texture compression formats.

[GitHub](https://github.com/BinomialLLC/basis_universal)

## Transcoders

Basis Universal texture data may be used in two different file formats:
`.basis` and `.ktx2`, where `ktx2` is a standardized wrapper around basis texture data.

For further documentation about the Basis compressor and transcoder, refer to
the [Basis GitHub repository](https://github.com/BinomialLLC/basis_universal).

The folder contains two files required for transcoding `.basis` or `.ktx2` textures:

* `basis_transcoder.js` — JavaScript wrapper for the WebAssembly transcoder.
* `basis_transcoder.wasm` — WebAssembly transcoder.

Both are dependencies of `KTX2Loader`:

```js
const ktx2Loader = new KTX2Loader();
ktx2Loader.setTranscoderPath( 'examples/jsm/libs/basis/' );
ktx2Loader.detectSupport( renderer );
ktx2Loader.load( 'diffuse.ktx2', function ( texture ) {

const material = new THREE.MeshStandardMaterial( { map: texture } );

}, function () {

console.log( 'onProgress' );

}, function ( e ) {

console.error( e );

} );
```

## License

[Apache License 2.0](https://github.com/BinomialLLC/basis_universal/blob/master/LICENSE)
21 changes: 21 additions & 0 deletions itowns/dev/examples/libs/basis/basis_transcoder.js

Large diffs are not rendered by default.

Binary file not shown.

0 comments on commit 6bedee6

Please sign in to comment.