|
@@ -12,7 +12,12 @@ var files = [
|
|
|
{ path: 'controls/MapControls.js', ignoreList: [] },
|
|
|
{ path: 'controls/TrackballControls.js', ignoreList: [] },
|
|
|
// { path: 'controls/TransformControls.js', ignoreList: [] },
|
|
|
- { path: 'exporters/GLTFExporter.js', ignoreList: [] },
|
|
|
+ { path: 'exporters/GLTFExporter.js', ignoreList: ['AnimationClip', 'Camera', 'Material', 'Mesh', 'Object3D', 'RGBFormat', 'Scenes', 'ShaderMaterial', 'VertexColors' ] },
|
|
|
+ { path: 'exporters/MMDExporter.js', ignoreList: [] },
|
|
|
+ { path: 'exporters/OBJExporter.js', ignoreList: [] },
|
|
|
+ { path: 'exporters/PLYExporter.js', ignoreList: [] },
|
|
|
+ { path: 'exporters/STLExporter.js', ignoreList: [] },
|
|
|
+ { path: 'exporters/TypedGeometryExporter.js', ignoreList: [] },
|
|
|
{ path: 'loaders/GLTFLoader.js', ignoreList: [ 'NoSide', 'Matrix2', 'DDSLoader' ] },
|
|
|
{ path: 'loaders/OBJLoader.js', ignoreList: [] },
|
|
|
{ path: 'loaders/MTLLoader.js', ignoreList: [] }
|
|
@@ -51,6 +56,14 @@ function convert( path, ignoreList ) {
|
|
|
if ( p1 === '\'' ) return match; // Inside a string
|
|
|
if ( p2 === className ) return `${p2}${p3}`;
|
|
|
|
|
|
+ if ( p1 === 'Math' ) {
|
|
|
+
|
|
|
+ dependencies[ '_Math' ] = true;
|
|
|
+
|
|
|
+ return '_Math.';
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
return match;
|
|
|
|
|
|
} );
|
|
@@ -72,7 +85,15 @@ function convert( path, ignoreList ) {
|
|
|
contents = contents.replace( /THREE\.([a-zA-Z0-9]+)/g, function ( match, p1 ) {
|
|
|
|
|
|
if ( ignoreList.includes( p1 ) ) return match;
|
|
|
- if ( p1 === className ) return match;
|
|
|
+ if ( p1 === className ) return p1;
|
|
|
+
|
|
|
+ if ( p1 === 'Math' || p1 === '_Math' ) {
|
|
|
+
|
|
|
+ dependencies[ '_Math' ] = true;
|
|
|
+
|
|
|
+ return '_Math';
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
dependencies[ p1 ] = true;
|
|
|
|
|
@@ -84,11 +105,16 @@ function convert( path, ignoreList ) {
|
|
|
|
|
|
//
|
|
|
|
|
|
- var keys = Object.keys( dependencies ).sort().map( value => '\n\t' + value ).toString();
|
|
|
+ var keys = Object.keys( dependencies )
|
|
|
+ .filter( value => value !== className )
|
|
|
+ .map( value => value === '_Math' ? 'Math as _Math' : value )
|
|
|
+ .map( value => '\n\t' + value )
|
|
|
+ .sort()
|
|
|
+ .toString();
|
|
|
var imports = `import {${keys}\n} from "../../../build/three.module.js";`;
|
|
|
var exports = `export { ${className} };\n`;
|
|
|
|
|
|
- var output = contents.replace( '_IMPORTS_', imports ) + '\n' + exports;
|
|
|
+ var output = contents.replace( '_IMPORTS_', keys ? imports : '' ) + '\n' + exports;
|
|
|
|
|
|
// console.log( output );
|
|
|
|