Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
}
</script>

<script src="../examples/jsm/libs/draco/draco_encoder.js"></script>
<script src="https://cdn.jsdelivr.net/gh/google/draco@1.5.7/javascript/draco_encoder.js"></script>

<link rel="stylesheet" href="js/libs/codemirror/codemirror.css">
<link rel="stylesheet" href="js/libs/codemirror/theme/monokai.css">
Expand Down
3 changes: 1 addition & 2 deletions editor/js/Menubar.File.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ function MenubarFile( editor ) {
exportColor: object.geometry.hasAttribute( 'color' )
};

// TODO: Change to DRACOExporter's parse( geometry, onParse )?
const result = exporter.parse( object, options );
const result = await exporter.parseAsync( object, options );
saveArrayBuffer( result, 'model.drc' );

} );
Expand Down
1 change: 0 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export default [
GPUTexture: 'readonly',
GPUMapMode: 'readonly',
QUnit: 'readonly',
Ammo: 'readonly',
XRRigidTransform: 'readonly',
XRMediaBinding: 'readonly',
CodeMirror: 'readonly',
Expand Down
6 changes: 0 additions & 6 deletions examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,6 @@
"games_fps"
],
"physics": [
"physics_ammo_break",
"physics_ammo_cloth",
"physics_ammo_instancing",
"physics_ammo_rope",
"physics_ammo_terrain",
"physics_ammo_volume",
"physics_jolt_instancing",
"physics_rapier_basic",
"physics_rapier_instancing",
Expand Down
1 change: 0 additions & 1 deletion examples/jsm/Addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export * from './objects/Sky.js';
export * from './objects/Water.js';
export { Water as Water2 } from './objects/Water2.js';

export * from './physics/AmmoPhysics.js';
export * from './physics/JoltPhysics.js';
export * from './physics/RapierPhysics.js';

Expand Down
31 changes: 26 additions & 5 deletions examples/jsm/exporters/DRACOExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ import { Color, ColorManagement, SRGBColorSpace } from 'three';
* inside of a glTF file. A normal glTF file can be converted to a Draco-compressed glTF file
* using [glTF-Pipeline](https://github.com/AnalyticalGraphicsInc/gltf-pipeline).
*
* The exporter requires the Draco encoder to be loaded as a global script in advance:
*
* ```html
* <script src="https://cdn.jsdelivr.net/gh/google/draco@1.5.7/javascript/draco_encoder.js"></script>
* ```
*
* ```js
* const exporter = new DRACOExporter();
* const data = exporter.parse( mesh, options );
* const data = await exporter.parseAsync( mesh, options );
* ```
*
* @three_import import { DRACOExporter } from 'three/addons/exporters/DRACOExporter.js';
Expand All @@ -27,11 +33,12 @@ class DRACOExporter {
/**
* Parses the given mesh or point cloud and generates the Draco output.
*
* @async
* @param {(Mesh|Points)} object - The mesh or point cloud to export.
* @param {DRACOExporter~Options} options - The export options.
* @return {Int8Array} The exported Draco.
* @return {Promise<Int8Array>} A Promise that resolves with the exported Draco.
*/
parse( object, options = {} ) {
async parseAsync( object, options = {} ) {

options = Object.assign( {
decodeSpeed: 5,
Expand All @@ -43,15 +50,20 @@ class DRACOExporter {
exportColor: false,
}, options );

if ( DracoEncoderModule === undefined ) {
if ( typeof DracoEncoderModule === 'undefined' ) {

throw new Error( 'THREE.DRACOExporter: required the draco_encoder to work.' );

}

const geometry = object.geometry;

const dracoEncoder = DracoEncoderModule();
let dracoEncoder = DracoEncoderModule();

// older encoder builds expose the module synchronously, newer builds return a promise

if ( dracoEncoder.Encoder === undefined ) dracoEncoder = await dracoEncoder;

const encoder = new dracoEncoder.Encoder();
let builder;
let dracoObject;
Expand Down Expand Up @@ -222,6 +234,15 @@ class DRACOExporter {

}

/**
* @deprecated Use {@link DRACOExporter#parseAsync} instead.
*/
parse() {

throw new Error( 'THREE.DRACOExporter: parse() has been replaced by parseAsync().' );

}

}

function createVertexColorSRGBArray( attribute ) {
Expand Down
822 changes: 0 additions & 822 deletions examples/jsm/libs/ammo.wasm.js

This file was deleted.

Binary file removed examples/jsm/libs/ammo.wasm.wasm
Binary file not shown.
33 changes: 0 additions & 33 deletions examples/jsm/libs/draco/draco_encoder.js

This file was deleted.

33 changes: 0 additions & 33 deletions examples/jsm/libs/draco/gltf/draco_encoder.js

This file was deleted.

Loading