OBJLoader.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. THREE.OBJLoader = ( function () {
  5. // v float float float
  6. var vertex_pattern = /^v\s+([\d\.\+\-eE]+)\s+([\d\.\+\-eE]+)\s+([\d\.\+\-eE]+)/;
  7. // vn float float float
  8. var normal_pattern = /^vn\s+([\d\.\+\-eE]+)\s+([\d\.\+\-eE]+)\s+([\d\.\+\-eE]+)/;
  9. // vt float float
  10. var uv_pattern = /^vt\s+([\d\.\+\-eE]+)\s+([\d\.\+\-eE]+)/;
  11. // f vertex vertex vertex
  12. var face_vertex = /^f\s+(-?\d+)\s+(-?\d+)\s+(-?\d+)(?:\s+(-?\d+))?/;
  13. // f vertex/uv vertex/uv vertex/uv
  14. var face_vertex_uv = /^f\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+))?/;
  15. // f vertex/uv/normal vertex/uv/normal vertex/uv/normal
  16. var face_vertex_uv_normal = /^f\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)\s+(-?\d+)\/(-?\d+)\/(-?\d+)(?:\s+(-?\d+)\/(-?\d+)\/(-?\d+))?/;
  17. // f vertex//normal vertex//normal vertex//normal
  18. var face_vertex_normal = /^f\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)\s+(-?\d+)\/\/(-?\d+)(?:\s+(-?\d+)\/\/(-?\d+))?/;
  19. // o object_name | g group_name
  20. var object_pattern = /^[og]\s*(.+)?/;
  21. // mtllib file_reference
  22. var material_library_pattern = /^mtllib /;
  23. // usemtl material_name
  24. var material_use_pattern = /^usemtl /;
  25. function ParserState() {
  26. var state = {
  27. objects : [],
  28. object : {},
  29. vertices : [],
  30. normals : [],
  31. uvs : [],
  32. materialLibraries : [],
  33. startObject: function ( name, fromDeclaration ) {
  34. // If the current object (initial from reset) is not from a g/o declaration in the parsed
  35. // file. We need to use it for the first parsed g/o to keep things in sync.
  36. if ( this.object && this.object.fromDeclaration === false ) {
  37. this.object.name = name;
  38. this.object.fromDeclaration = ( fromDeclaration !== false );
  39. return;
  40. }
  41. var previousMaterial = ( this.object && typeof this.object.currentMaterial === 'function' ? this.object.currentMaterial() : undefined );
  42. if ( this.object && typeof this.object._finalize === 'function' ) {
  43. this.object._finalize( true );
  44. }
  45. this.object = {
  46. name : name || '',
  47. fromDeclaration : ( fromDeclaration !== false ),
  48. geometry : {
  49. vertices : [],
  50. normals : [],
  51. uvs : []
  52. },
  53. materials : [],
  54. smooth : true,
  55. startMaterial : function( name, libraries ) {
  56. var previous = this._finalize( false );
  57. // New usemtl declaration overwrites an inherited material, except if faces were declared
  58. // after the material, then it must be preserved for proper MultiMaterial continuation.
  59. if ( previous && ( previous.inherited || previous.groupCount <= 0 ) ) {
  60. this.materials.splice( previous.index, 1 );
  61. }
  62. var material = {
  63. index : this.materials.length,
  64. name : name || '',
  65. mtllib : ( Array.isArray( libraries ) && libraries.length > 0 ? libraries[ libraries.length - 1 ] : '' ),
  66. smooth : ( previous !== undefined ? previous.smooth : this.smooth ),
  67. groupStart : ( previous !== undefined ? previous.groupEnd : 0 ),
  68. groupEnd : -1,
  69. groupCount : -1,
  70. inherited : false,
  71. clone : function( index ) {
  72. var cloned = {
  73. index : ( typeof index === 'number' ? index : this.index ),
  74. name : this.name,
  75. mtllib : this.mtllib,
  76. smooth : this.smooth,
  77. groupStart : 0,
  78. groupEnd : -1,
  79. groupCount : -1,
  80. inherited : false
  81. };
  82. cloned.clone = this.clone.bind(cloned);
  83. return cloned;
  84. }
  85. };
  86. this.materials.push( material );
  87. return material;
  88. },
  89. currentMaterial : function() {
  90. if ( this.materials.length > 0 ) {
  91. return this.materials[ this.materials.length - 1 ];
  92. }
  93. return undefined;
  94. },
  95. _finalize : function( end ) {
  96. var lastMultiMaterial = this.currentMaterial();
  97. if ( lastMultiMaterial && lastMultiMaterial.groupEnd === -1 ) {
  98. lastMultiMaterial.groupEnd = this.geometry.vertices.length / 3;
  99. lastMultiMaterial.groupCount = lastMultiMaterial.groupEnd - lastMultiMaterial.groupStart;
  100. lastMultiMaterial.inherited = false;
  101. }
  102. // Ignore objects tail materials if no face declarations followed them before a new o/g started.
  103. if ( end && this.materials.length > 1 ) {
  104. for ( var mi = this.materials.length - 1; mi >= 0; mi-- ) {
  105. if ( this.materials[ mi ].groupCount <= 0 ) {
  106. this.materials.splice( mi, 1 );
  107. }
  108. }
  109. }
  110. // Guarantee at least one empty material, this makes the creation later more straight forward.
  111. if ( end && this.materials.length === 0 ) {
  112. this.materials.push({
  113. name : '',
  114. smooth : this.smooth
  115. });
  116. }
  117. return lastMultiMaterial;
  118. }
  119. };
  120. // Inherit previous objects material.
  121. // Spec tells us that a declared material must be set to all objects until a new material is declared.
  122. // If a usemtl declaration is encountered while this new object is being parsed, it will
  123. // overwrite the inherited material. Exception being that there was already face declarations
  124. // to the inherited material, then it will be preserved for proper MultiMaterial continuation.
  125. if ( previousMaterial && previousMaterial.name && typeof previousMaterial.clone === "function" ) {
  126. var declared = previousMaterial.clone( 0 );
  127. declared.inherited = true;
  128. this.object.materials.push( declared );
  129. }
  130. this.objects.push( this.object );
  131. },
  132. finalize : function() {
  133. if ( this.object && typeof this.object._finalize === 'function' ) {
  134. this.object._finalize( true );
  135. }
  136. },
  137. parseVertexIndex: function ( value, len ) {
  138. var index = parseInt( value, 10 );
  139. return ( index >= 0 ? index - 1 : index + len / 3 ) * 3;
  140. },
  141. parseNormalIndex: function ( value, len ) {
  142. var index = parseInt( value, 10 );
  143. return ( index >= 0 ? index - 1 : index + len / 3 ) * 3;
  144. },
  145. parseUVIndex: function ( value, len ) {
  146. var index = parseInt( value, 10 );
  147. return ( index >= 0 ? index - 1 : index + len / 2 ) * 2;
  148. },
  149. addVertex: function ( a, b, c ) {
  150. var src = this.vertices;
  151. var dst = this.object.geometry.vertices;
  152. dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
  153. dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
  154. dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
  155. },
  156. addVertexLine: function ( a ) {
  157. var src = this.vertices;
  158. var dst = this.object.geometry.vertices;
  159. dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
  160. },
  161. addNormal : function ( a, b, c ) {
  162. var src = this.normals;
  163. var dst = this.object.geometry.normals;
  164. dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
  165. dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
  166. dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
  167. },
  168. addUV: function ( a, b, c ) {
  169. var src = this.uvs;
  170. var dst = this.object.geometry.uvs;
  171. dst.push( src[ a + 0 ], src[ a + 1 ] );
  172. dst.push( src[ b + 0 ], src[ b + 1 ] );
  173. dst.push( src[ c + 0 ], src[ c + 1 ] );
  174. },
  175. addUVLine: function ( a ) {
  176. var src = this.uvs;
  177. var dst = this.object.geometry.uvs;
  178. dst.push( src[ a + 0 ], src[ a + 1 ] );
  179. },
  180. addFace: function ( a, b, c, d, ua, ub, uc, ud, na, nb, nc, nd ) {
  181. var vLen = this.vertices.length;
  182. var ia = this.parseVertexIndex( a, vLen );
  183. var ib = this.parseVertexIndex( b, vLen );
  184. var ic = this.parseVertexIndex( c, vLen );
  185. var id;
  186. if ( d === undefined ) {
  187. this.addVertex( ia, ib, ic );
  188. } else {
  189. id = this.parseVertexIndex( d, vLen );
  190. this.addVertex( ia, ib, id );
  191. this.addVertex( ib, ic, id );
  192. }
  193. if ( ua !== undefined ) {
  194. var uvLen = this.uvs.length;
  195. ia = this.parseUVIndex( ua, uvLen );
  196. ib = this.parseUVIndex( ub, uvLen );
  197. ic = this.parseUVIndex( uc, uvLen );
  198. if ( d === undefined ) {
  199. this.addUV( ia, ib, ic );
  200. } else {
  201. id = this.parseUVIndex( ud, uvLen );
  202. this.addUV( ia, ib, id );
  203. this.addUV( ib, ic, id );
  204. }
  205. }
  206. if ( na !== undefined ) {
  207. // Normals are many times the same. If so, skip function call and parseInt.
  208. var nLen = this.normals.length;
  209. ia = this.parseNormalIndex( na, nLen );
  210. ib = na === nb ? ia : this.parseNormalIndex( nb, nLen );
  211. ic = na === nc ? ia : this.parseNormalIndex( nc, nLen );
  212. if ( d === undefined ) {
  213. this.addNormal( ia, ib, ic );
  214. } else {
  215. id = this.parseNormalIndex( nd, nLen );
  216. this.addNormal( ia, ib, id );
  217. this.addNormal( ib, ic, id );
  218. }
  219. }
  220. },
  221. addLineGeometry: function ( vertices, uvs ) {
  222. this.object.geometry.type = 'Line';
  223. var vLen = this.vertices.length;
  224. var uvLen = this.uvs.length;
  225. for ( var vi = 0, l = vertices.length; vi < l; vi ++ ) {
  226. this.addVertexLine( this.parseVertexIndex( vertices[ vi ], vLen ) );
  227. }
  228. for ( var uvi = 0, l = uvs.length; uvi < l; uvi ++ ) {
  229. this.addUVLine( this.parseUVIndex( uvs[ uvi ], uvLen ) );
  230. }
  231. }
  232. };
  233. state.startObject( '', false );
  234. return state;
  235. }
  236. //
  237. function OBJLoader( manager ) {
  238. this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
  239. this.materials = null;
  240. };
  241. OBJLoader.prototype = {
  242. constructor: OBJLoader,
  243. load: function ( url, onLoad, onProgress, onError ) {
  244. var scope = this;
  245. var loader = new THREE.FileLoader( scope.manager );
  246. loader.setPath( this.path );
  247. loader.load( url, function ( text ) {
  248. onLoad( scope.parse( text ) );
  249. }, onProgress, onError );
  250. },
  251. setPath: function ( value ) {
  252. this.path = value;
  253. },
  254. setMaterials: function ( materials ) {
  255. this.materials = materials;
  256. return this;
  257. },
  258. parse: function ( text ) {
  259. console.time( 'OBJLoader' );
  260. var state = new ParserState();
  261. if ( text.indexOf( '\r\n' ) !== - 1 ) {
  262. // This is faster than String.split with regex that splits on both
  263. text = text.replace( /\r\n/g, '\n' );
  264. }
  265. if ( text.indexOf( '\\\n' ) !== - 1) {
  266. // join lines separated by a line continuation character (\)
  267. text = text.replace( /\\\n/g, '' );
  268. }
  269. var lines = text.split( '\n' );
  270. var line = '', lineFirstChar = '', lineSecondChar = '';
  271. var lineLength = 0;
  272. var result = [];
  273. // Faster to just trim left side of the line. Use if available.
  274. var trimLeft = ( typeof ''.trimLeft === 'function' );
  275. for ( var i = 0, l = lines.length; i < l; i ++ ) {
  276. line = lines[ i ];
  277. line = trimLeft ? line.trimLeft() : line.trim();
  278. lineLength = line.length;
  279. if ( lineLength === 0 ) continue;
  280. lineFirstChar = line.charAt( 0 );
  281. // @todo invoke passed in handler if any
  282. if ( lineFirstChar === '#' ) continue;
  283. if ( lineFirstChar === 'v' ) {
  284. lineSecondChar = line.charAt( 1 );
  285. if ( lineSecondChar === ' ' && ( result = vertex_pattern.exec( line ) ) !== null ) {
  286. // 0 1 2 3
  287. // ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
  288. state.vertices.push(
  289. parseFloat( result[ 1 ] ),
  290. parseFloat( result[ 2 ] ),
  291. parseFloat( result[ 3 ] )
  292. );
  293. } else if ( lineSecondChar === 'n' && ( result = normal_pattern.exec( line ) ) !== null ) {
  294. // 0 1 2 3
  295. // ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
  296. state.normals.push(
  297. parseFloat( result[ 1 ] ),
  298. parseFloat( result[ 2 ] ),
  299. parseFloat( result[ 3 ] )
  300. );
  301. } else if ( lineSecondChar === 't' && ( result = uv_pattern.exec( line ) ) !== null ) {
  302. // 0 1 2
  303. // ["vt 0.1 0.2", "0.1", "0.2"]
  304. state.uvs.push(
  305. parseFloat( result[ 1 ] ),
  306. parseFloat( result[ 2 ] )
  307. );
  308. } else {
  309. throw new Error( "Unexpected vertex/normal/uv line: '" + line + "'" );
  310. }
  311. } else if ( lineFirstChar === "f" ) {
  312. if ( ( result = face_vertex_uv_normal.exec( line ) ) !== null ) {
  313. // f vertex/uv/normal vertex/uv/normal vertex/uv/normal
  314. // 0 1 2 3 4 5 6 7 8 9 10 11 12
  315. // ["f 1/1/1 2/2/2 3/3/3", "1", "1", "1", "2", "2", "2", "3", "3", "3", undefined, undefined, undefined]
  316. state.addFace(
  317. result[ 1 ], result[ 4 ], result[ 7 ], result[ 10 ],
  318. result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ],
  319. result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ]
  320. );
  321. } else if ( ( result = face_vertex_uv.exec( line ) ) !== null ) {
  322. // f vertex/uv vertex/uv vertex/uv
  323. // 0 1 2 3 4 5 6 7 8
  324. // ["f 1/1 2/2 3/3", "1", "1", "2", "2", "3", "3", undefined, undefined]
  325. state.addFace(
  326. result[ 1 ], result[ 3 ], result[ 5 ], result[ 7 ],
  327. result[ 2 ], result[ 4 ], result[ 6 ], result[ 8 ]
  328. );
  329. } else if ( ( result = face_vertex_normal.exec( line ) ) !== null ) {
  330. // f vertex//normal vertex//normal vertex//normal
  331. // 0 1 2 3 4 5 6 7 8
  332. // ["f 1//1 2//2 3//3", "1", "1", "2", "2", "3", "3", undefined, undefined]
  333. state.addFace(
  334. result[ 1 ], result[ 3 ], result[ 5 ], result[ 7 ],
  335. undefined, undefined, undefined, undefined,
  336. result[ 2 ], result[ 4 ], result[ 6 ], result[ 8 ]
  337. );
  338. } else if ( ( result = face_vertex.exec( line ) ) !== null ) {
  339. // f vertex vertex vertex
  340. // 0 1 2 3 4
  341. // ["f 1 2 3", "1", "2", "3", undefined]
  342. state.addFace(
  343. result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ]
  344. );
  345. } else {
  346. throw new Error( "Unexpected face line: '" + line + "'" );
  347. }
  348. } else if ( lineFirstChar === "l" ) {
  349. var lineParts = line.substring( 1 ).trim().split( " " );
  350. var lineVertices = [], lineUVs = [];
  351. if ( line.indexOf( "/" ) === - 1 ) {
  352. lineVertices = lineParts;
  353. } else {
  354. for ( var li = 0, llen = lineParts.length; li < llen; li ++ ) {
  355. var parts = lineParts[ li ].split( "/" );
  356. if ( parts[ 0 ] !== "" ) lineVertices.push( parts[ 0 ] );
  357. if ( parts[ 1 ] !== "" ) lineUVs.push( parts[ 1 ] );
  358. }
  359. }
  360. state.addLineGeometry( lineVertices, lineUVs );
  361. } else if ( ( result = object_pattern.exec( line ) ) !== null ) {
  362. // o object_name
  363. // or
  364. // g group_name
  365. // WORKAROUND: https://bugs.chromium.org/p/v8/issues/detail?id=2869
  366. // var name = result[ 0 ].substr( 1 ).trim();
  367. var name = ( " " + result[ 0 ].substr( 1 ).trim() ).substr( 1 );
  368. state.startObject( name );
  369. } else if ( material_use_pattern.test( line ) ) {
  370. // material
  371. state.object.startMaterial( line.substring( 7 ).trim(), state.materialLibraries );
  372. } else if ( material_library_pattern.test( line ) ) {
  373. // mtl file
  374. state.materialLibraries.push( line.substring( 7 ).trim() );
  375. } else if ( lineFirstChar === "s" ) {
  376. result = line.split( ' ' );
  377. // smooth shading
  378. // @todo Handle files that have varying smooth values for a set of faces inside one geometry,
  379. // but does not define a usemtl for each face set.
  380. // This should be detected and a dummy material created (later MultiMaterial and geometry groups).
  381. // This requires some care to not create extra material on each smooth value for "normal" obj files.
  382. // where explicit usemtl defines geometry groups.
  383. // Example asset: examples/models/obj/cerberus/Cerberus.obj
  384. /*
  385. * http://paulbourke.net/dataformats/obj/
  386. * or
  387. * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
  388. *
  389. * From chapter "Grouping" Syntax explanation "s group_number":
  390. * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
  391. * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
  392. * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
  393. * than 0."
  394. */
  395. if ( result.length > 1 ) {
  396. var value = result[ 1 ].trim().toLowerCase();
  397. state.object.smooth = ( value !== '0' && value !== 'off' );
  398. } else {
  399. state.object.smooth = true;
  400. }
  401. var material = state.object.currentMaterial();
  402. if ( material ) material.smooth = state.object.smooth;
  403. } else {
  404. // Handle null terminated files without exception
  405. if ( line === '\0' ) continue;
  406. throw new Error( "Unexpected line: '" + line + "'" );
  407. }
  408. }
  409. state.finalize();
  410. var container = new THREE.Group();
  411. container.materialLibraries = [].concat( state.materialLibraries );
  412. for ( var i = 0, l = state.objects.length; i < l; i ++ ) {
  413. var object = state.objects[ i ];
  414. var geometry = object.geometry;
  415. var materials = object.materials;
  416. var isLine = ( geometry.type === 'Line' );
  417. // Skip o/g line declarations that did not follow with any faces
  418. if ( geometry.vertices.length === 0 ) continue;
  419. var buffergeometry = new THREE.BufferGeometry();
  420. buffergeometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( geometry.vertices ), 3 ) );
  421. if ( geometry.normals.length > 0 ) {
  422. buffergeometry.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( geometry.normals ), 3 ) );
  423. } else {
  424. buffergeometry.computeVertexNormals();
  425. }
  426. if ( geometry.uvs.length > 0 ) {
  427. buffergeometry.addAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( geometry.uvs ), 2 ) );
  428. }
  429. // Create materials
  430. var createdMaterials = [];
  431. for ( var mi = 0, miLen = materials.length; mi < miLen ; mi++ ) {
  432. var sourceMaterial = materials[ mi ];
  433. var material = undefined;
  434. if ( this.materials !== null ) {
  435. material = this.materials.create( sourceMaterial.name );
  436. // mtl etc. loaders probably can't create line materials correctly, copy properties to a line material.
  437. if ( isLine && material && ! ( material instanceof THREE.LineBasicMaterial ) ) {
  438. var materialLine = new THREE.LineBasicMaterial();
  439. materialLine.copy( material );
  440. material = materialLine;
  441. }
  442. }
  443. if ( ! material ) {
  444. material = ( ! isLine ? new THREE.MeshPhongMaterial() : new THREE.LineBasicMaterial() );
  445. material.name = sourceMaterial.name;
  446. }
  447. material.flatShading = sourceMaterial.smooth ? false : true;
  448. createdMaterials.push(material);
  449. }
  450. // Create mesh
  451. var mesh;
  452. if ( createdMaterials.length > 1 ) {
  453. for ( var mi = 0, miLen = materials.length; mi < miLen ; mi++ ) {
  454. var sourceMaterial = materials[ mi ];
  455. buffergeometry.addGroup( sourceMaterial.groupStart, sourceMaterial.groupCount, mi );
  456. }
  457. mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, createdMaterials ) : new THREE.LineSegments( buffergeometry, createdMaterials ) );
  458. } else {
  459. mesh = ( ! isLine ? new THREE.Mesh( buffergeometry, createdMaterials[ 0 ] ) : new THREE.LineSegments( buffergeometry, createdMaterials[ 0 ] ) );
  460. }
  461. mesh.name = object.name;
  462. container.add( mesh );
  463. }
  464. console.timeEnd( 'OBJLoader' );
  465. return container;
  466. }
  467. };
  468. return OBJLoader;
  469. } )();