Skip to content

Commit

Permalink
Remove unneeded crossOrigin configuration for THREE loaders (#5416)
Browse files Browse the repository at this point in the history
Co-authored-by: Noeri Huisman <[email protected]>
  • Loading branch information
mrxz and mrxz authored Dec 17, 2023
1 parent c6962ad commit e86d107
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
19 changes: 0 additions & 19 deletions src/lib/three.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
var THREE = require('./three.module.js').default;

// Allow cross-origin images to be loaded.

// This should not be on `THREE.Loader` nor `THREE.ImageUtils`.
// Must be on `THREE.TextureLoader`.
if (THREE.TextureLoader) {
THREE.TextureLoader.prototype.crossOrigin = 'anonymous';
}

// This is for images loaded from the model loaders.
if (THREE.ImageLoader) {
THREE.ImageLoader.prototype.crossOrigin = 'anonymous';
}

// In-memory caching for XHRs (for images, audio files, textures, etc.).
if (THREE.Cache) {
THREE.Cache.enabled = true;
}

THREE.DRACOLoader.prototype.crossOrigin = 'anonymous';
THREE.GLTFLoader.prototype.crossOrigin = 'anonymous';
THREE.KTX2Loader.prototype.crossOrigin = 'anonymous';
THREE.MTLLoader.prototype.crossOrigin = 'anonymous';
THREE.OBJLoader.prototype.crossOrigin = 'anonymous';

module.exports = THREE;
3 changes: 1 addition & 2 deletions src/lib/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { MTLLoader } from 'super-three/examples/jsm/loaders/MTLLoader';
import * as BufferGeometryUtils from 'super-three/examples/jsm/utils/BufferGeometryUtils';
import { LightProbeGenerator } from 'super-three/examples/jsm/lights/LightProbeGenerator';

var objectAssign = require('object-assign');
var THREE = window.THREE = objectAssign({}, SUPER_THREE);
var THREE = window.THREE = SUPER_THREE;

// TODO: Eventually include these only if they are needed by a component.
require('../../vendor/DeviceOrientationControls'); // THREE.DeviceOrientationControls
Expand Down

0 comments on commit e86d107

Please sign in to comment.