@@ -28,6 +28,8 @@ THREE.TDSLoader.prototype = {
2828
2929 constructor : THREE . TDSLoader ,
3030
31+ crossOrigin : 'anonymous' ,
32+
3133 /**
3234 * Load 3ds file from url.
3335 *
@@ -44,7 +46,7 @@ THREE.TDSLoader.prototype = {
4446 var path = this . path !== undefined ? this . path : THREE . LoaderUtils . extractUrlBase ( url ) ;
4547
4648 var loader = new THREE . FileLoader ( this . manager ) ;
47-
49+ loader . setPath ( this . path ) ;
4850 loader . setResponseType ( 'arraybuffer' ) ;
4951
5052 loader . load ( url , function ( data ) {
@@ -520,7 +522,7 @@ THREE.TDSLoader.prototype = {
520522 var texture = { } ;
521523
522524 var loader = new THREE . TextureLoader ( this . manager ) ;
523- loader . setPath ( path ) ;
525+ loader . setPath ( this . resourcePath || path ) . setCrossOrigin ( this . crossOrigin ) ;
524526
525527 while ( next !== 0 ) {
526528
@@ -842,10 +844,10 @@ THREE.TDSLoader.prototype = {
842844 } ,
843845
844846 /**
845- * Set resource path used to determine the file path to attached resources .
847+ * Set path to adjust the path to the original 3ds file .
846848 *
847849 * @method setPath
848- * @param {String } path Path to resources .
850+ * @param {String } path Path to file .
849851 * @return Self for chaining.
850852 */
851853 setPath : function ( path ) {
@@ -856,6 +858,37 @@ THREE.TDSLoader.prototype = {
856858
857859 } ,
858860
861+ /**
862+ * Set resource path used to determine the path to attached resources like textures.
863+ *
864+ * @method setResourcePath
865+ * @param {String } resourcePath Path to resources.
866+ * @return Self for chaining.
867+ */
868+ setResourcePath : function ( resourcePath ) {
869+
870+ this . resourcePath = resourcePath ;
871+
872+ return this ;
873+
874+ } ,
875+
876+ /**
877+ * Set crossOrigin value to configure CORS settings
878+ * for the image loading process.
879+ *
880+ * @method setCrossOrigin
881+ * @param {String } crossOrigin crossOrigin string.
882+ * @return Self for chaining.
883+ */
884+ setCrossOrigin : function ( crossOrigin ) {
885+
886+ this . crossOrigin = crossOrigin ;
887+
888+ return this ;
889+
890+ } ,
891+
859892 /**
860893 * Print debug message to the console.
861894 *
0 commit comments