How to use the DRACOLoader function from three

Find comprehensive JavaScript three.DRACOLoader code examples handpicked from public code repositorys.

89
90
91
92
93
94
95
96
97
}

if (loader instanceof THREE.GLTFLoader) {
  console.log('Enabling Draco support');
  THREE.DRACOLoader.setDecoderPath( 'lib/draco/' );
  loader.setDRACOLoader( new THREE.DRACOLoader( manager ) );
}

const blobURLs = [];
fork icon460
star icon11
watch icon4

+ 3 other calls in file

53
54
55
56
57
58
59
60
61
let loadingManager = new THREE.LoadingManager()
let loader = new THREE.JDLoader()
let fbxLoader = new THREE.FBXLoader(loadingManager)
let objLoader = new THREE.OBJLoader2(loadingManager)
let gltfLoader = new THREE.GLTFLoader(loadingManager)
gltfLoader.setDRACOLoader(new THREE.DRACOLoader())
objLoader.setLogging(false, false)
let textures = {}
let characterModels = {}
fork icon263
star icon0
watch icon2

425
426
427
428
429
430
431
432
433
434
 * Sets decoder configuration and releases singleton decoder module. Module
 * will be recreated with the next decoding call.
 * @param {Object} config
 */
DRACOLoader.setDecoderConfig = function ( config ) {
    var wasmBinary = THREE.DRACOLoader.decoderConfig.wasmBinary;
    DRACOLoader.decoderConfig = config || {};
    DRACOLoader.releaseDecoderModule();

    // Reuse WASM binary.
fork icon4
star icon26
watch icon0

+ 5 other calls in file

112
113
114
115
116
117
118
119
120
121
  callback,
  attributeUniqueIdMap,
  attributeTypeMap
) {
  var scope = this;
  THREE.DRACOLoader.getDecoderModule().then(function (module) {
    const decoderPromise = module.decoder
    decoderPromise.then(decoder => {
      scope.decodeDracoFileInternal(
        rawBuffer,
fork icon3
star icon7
watch icon8

+ 224 other calls in file

20
21
22
23
24
25
26
27
28
29
const USDZExporter = require('./USDZExporter')

class NodeThreeExporter {
  constructor() {
    this.gltfLoader = new THREE.GLTFLoader()
    this.gltfLoader.setDRACOLoader(new THREE.DRACOLoader())
    this.objLoader = new THREE.OBJLoader()
    this.fbxLoader = new THREE.FBXLoader()
    this.stlLoader = new THREE.STLLoader()
    this.gltfExporter = new THREE.GLTFExporter()
fork icon3
star icon4
watch icon2

263
264
265
266
267
268
269
270
271
272
  this.setContent(scene, clips);

  blobURLs.forEach(URL.revokeObjectURL);

  // See: https://github.com/google/draco/issues/349
  // THREE.DRACOLoader.releaseDecoderModule();

  resolve();

}, undefined, reject);
fork icon0
star icon0
watch icon0

+ 11 other calls in file

17
18
19
20
21
22
23
24
25
26
  THREE.Cache.enabled = true;
}

// TODO: Eventually include these only if they are needed by a component.
require('../../vendor/DeviceOrientationControls'); // THREE.DeviceOrientationControls
require('three/examples/js/loaders/DRACOLoader');  // THREE.DRACOLoader
require('three/examples/js/loaders/GLTFLoader');  // THREE.GLTFLoader
require('three/examples/js/loaders/OBJLoader');  // THREE.OBJLoader
require('three/examples/js/loaders/MTLLoader');  // THREE.MTLLoader
require('three/examples/js/utils/BufferGeometryUtils');  // THREE.BufferGeometryUtils
fork icon0
star icon0
watch icon0

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)