Browse Source

Merge pull request #20936 from Mugen87/dev2

Remove converter scripts.
Mr.doob 4 years ago
parent
commit
ff3cf26f50
3 changed files with 0 additions and 128 deletions
  1. 0 18
      utils/converters/README.md
  2. 0 81
      utils/converters/fbx2three.js
  3. 0 29
      utils/converters/obj2three.js

+ 0 - 18
utils/converters/README.md

@@ -1,18 +0,0 @@
-Utilities for converting model files to the Three.js JSON format.
-It's necessary to install the [esm](https://www.npmjs.com/package/esm) npm package before you can use the converters.
-
-## obj2three.js
-
-Usage:
-
-```
-node -r esm obj2three.js model.obj
-```
-
-## fbx2three.js
-
-Usage:
-
-```
-node -r esm fbx2three.js model.fbx
-```

+ 0 - 81
utils/converters/fbx2three.js

@@ -1,81 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-
-import { FBXLoader } from '../../examples/jsm/loaders/FBXLoader.js';
-import { ImageLoader, ImageUtils, LoaderUtils } from '../../build/three.module.js';
-
-if ( process.argv.length <= 2 ) {
-
-	console.log( `Usage: ${path.basename( __filename )} model.fbx` );
-	process.exit( - 1 );
-
-}
-
-//
-
-const PRECISION = 6;
-
-function parseNumber( key, value ) {
-
-	return typeof value === 'number' ? parseFloat( value.toFixed( PRECISION ) ) : value;
-
-}
-
-global.window = {
-	innerWidth: 1024,
-	innerHeight: 768,
-	URL: {
-
-		createObjectURL: function () {
-
-			throw new Error( 'fbx2three: Images in binary format not yet supported.' );
-
-		}
-
-	}
-};
-
-// HTML Images are not available, so use a Buffer instead.
-ImageLoader.prototype.load = function ( url, onLoad ) {
-
-	if ( this.path !== undefined ) url = this.path + url;
-
-	// If image isn't found, try to ignore it.
-	if ( ! fs.existsSync( url ) ) {
-
-		onLoad( new Buffer( '' ) );
-		return;
-
-	}
-
-	onLoad( fs.readFileSync( url ) );
-
-};
-
-// Convert image buffer to data URL.
-ImageUtils.getDataURL = function ( image ) {
-
-	if ( ! ( image instanceof Buffer ) ) {
-
-		throw new Error( 'fbx2three: Image should be loaded as Buffer.' );
-
-	}
-
-	let dataURL = 'data:';
-	dataURL += this.format === THREE.RGBAFormat ? 'image/png' : 'image/jpeg';
-	dataURL += ';base64,';
-	dataURL += image.toString( 'base64' );
-	return dataURL;
-
-};
-
-//
-
-const file = process.argv[ 2 ];
-const resourceDirectory = LoaderUtils.extractUrlBase( file );
-const loader = new FBXLoader();
-
-const arraybuffer = fs.readFileSync( file ).buffer;
-const object = loader.parse( arraybuffer, resourceDirectory );
-const content = JSON.stringify( object.toJSON(), parseNumber );
-fs.writeFileSync( path.basename( file, '.fbx' ) + '.json', content, 'utf8' );

+ 0 - 29
utils/converters/obj2three.js

@@ -1,29 +0,0 @@
-import fs from 'fs';
-import path from 'path';
-
-import { OBJLoader } from '../../examples/jsm/loaders/OBJLoader.js';
-
-if ( process.argv.length <= 2 ) {
-
-	console.log( "Usage: " + path.basename( __filename ) + " model.obj" );
-	process.exit( - 1 );
-
-}
-
-//
-
-const PRECISION = 6;
-
-function parseNumber( key, value ) {
-
-	return typeof value === 'number' ? parseFloat( value.toFixed( PRECISION ) ) : value;
-
-}
-
-const file = process.argv[ 2 ];
-const loader = new OBJLoader();
-
-const text = fs.readFileSync( file, 'utf8' );
-
-const content = JSON.stringify( loader.parse( text ).toJSON(), parseNumber );
-fs.writeFileSync( path.basename( file, '.obj' ) + '.json', content, 'utf8' );