@@ -26,70 +26,60 @@ var Loader = function (state)
2626Loader . prototype = Object . create ( BaseLoader . prototype ) ;
2727Loader . prototype . constructor = Loader ;
2828
29- Loader . prototype . image = function ( key , url )
29+ Loader . prototype . image = function ( key , url , xhrSettings )
3030{
31- var file = new ImageFile ( key , url , this . path ) ;
31+ var file = new ImageFile ( key , url , this . path , xhrSettings ) ;
3232
33- this . addFile ( file ) ;
34-
35- return this ;
33+ return this . addFile ( file ) ;
3634} ;
3735
38- Loader . prototype . json = function ( key , url )
36+ Loader . prototype . json = function ( key , url , xhrSettings )
3937{
40- var file = new JSONFile ( key , url , this . path ) ;
38+ var file = new JSONFile ( key , url , this . path , xhrSettings ) ;
4139
42- this . addFile ( file ) ;
43-
44- return this ;
40+ return this . addFile ( file ) ;
4541} ;
4642
47- Loader . prototype . xml = function ( key , url )
43+ Loader . prototype . xml = function ( key , url , xhrSettings )
4844{
49- var file = new XMLFile ( key , url , this . path ) ;
45+ var file = new XMLFile ( key , url , this . path , xhrSettings ) ;
5046
51- this . addFile ( file ) ;
52-
53- return this ;
47+ return this . addFile ( file ) ;
5448} ;
5549
56- Loader . prototype . binary = function ( key , url )
50+ Loader . prototype . binary = function ( key , url , xhrSettings )
5751{
58- var file = new BinaryFile ( key , url , this . path ) ;
52+ var file = new BinaryFile ( key , url , this . path , xhrSettings ) ;
5953
60- this . addFile ( file ) ;
61-
62- return this ;
54+ return this . addFile ( file ) ;
6355} ;
6456
65- Loader . prototype . text = function ( key , url )
57+ Loader . prototype . text = function ( key , url , xhrSettings )
6658{
67- var file = new TextFile ( key , url , this . path ) ;
59+ var file = new TextFile ( key , url , this . path , xhrSettings ) ;
6860
69- this . addFile ( file ) ;
70-
71- return this ;
61+ return this . addFile ( file ) ;
7262} ;
7363
74- Loader . prototype . glsl = function ( key , url )
64+ Loader . prototype . glsl = function ( key , url , xhrSettings )
7565{
76- var file = new GLSLFile ( key , url , this . path ) ;
66+ var file = new GLSLFile ( key , url , this . path , xhrSettings ) ;
7767
78- this . addFile ( file ) ;
79-
80- return this ;
68+ return this . addFile ( file ) ;
8169} ;
8270
83- Loader . prototype . atlas = function ( key , textureURL , atlasURL )
71+ Loader . prototype . atlas = function ( key , textureURL , atlasURL , textureXhrSettings , atlasXhrSettings )
8472{
85- var file = new AtlasJSONFile ( key , textureURL , atlasURL , this . path ) ;
73+ // Returns an object with two properties: 'texture' and 'data'
74+ var files = new AtlasJSONFile ( key , textureURL , atlasURL , this . path , textureXhrSettings , atlasXhrSettings ) ;
8675
87- this . addFile ( file ) ;
76+ this . addFile ( files . texture ) ;
77+ this . addFile ( files . data ) ;
8878
8979 return this ;
9080} ;
9181
92- Loader . prototype . multiatlas = function ( key , textureURLs , atlasURLs )
82+ Loader . prototype . multiatlas = function ( key , textureURLs , atlasURLs , textureXhrSettings , atlasXhrSettings )
9383{
9484 if ( typeof textureURLs === 'number' )
9585 {
@@ -111,6 +101,7 @@ Loader.prototype.multiatlas = function (key, textureURLs, atlasURLs)
111101 }
112102 }
113103
104+ var file ;
114105 var i = 0 ;
115106 var multiKey ;
116107
@@ -120,7 +111,9 @@ Loader.prototype.multiatlas = function (key, textureURLs, atlasURLs)
120111 {
121112 multiKey = '_MA_IMG_' + key + '_' + i . toString ( ) ;
122113
123- this . addFile ( new ImageFile ( multiKey , textureURLs [ i ] , this . path ) ) ;
114+ file = new ImageFile ( multiKey , textureURLs [ i ] , this . path , textureXhrSettings ) ;
115+
116+ this . addFile ( file ) ;
124117
125118 this . _multilist [ key ] . push ( multiKey ) ;
126119 }
@@ -129,7 +122,9 @@ Loader.prototype.multiatlas = function (key, textureURLs, atlasURLs)
129122 {
130123 multiKey = '_MA_JSON_' + key + '_' + i . toString ( ) ;
131124
132- this . addFile ( new JSONFile ( multiKey , atlasURLs [ i ] , this . path ) ) ;
125+ file = new JSONFile ( multiKey , atlasURLs [ i ] , this . path , atlasXhrSettings ) ;
126+
127+ this . addFile ( file ) ;
133128
134129 this . _multilist [ key ] . push ( multiKey ) ;
135130 }
0 commit comments