Renaming files

This commit is contained in:
Sean Lilley 2017-04-12 16:55:03 -04:00
parent cc8fee19c4
commit 37febbcd93
14 changed files with 44 additions and 44 deletions

View File

@ -27,7 +27,7 @@ Using obj2gltf as a command-line tool:
## Usage
###Command line flags:
### Command line flags:
|Flag|Description|Required|
|----|-----------|--------|
@ -62,7 +62,7 @@ To run JSHint automatically when a file is saved, run the following and leave it
npm run jsHint-watch
```
### Running Test Coverage
## Running Test Coverage
Coverage uses [istanbul](https://github.com/gotwarlost/istanbul). Run:
```
@ -81,7 +81,7 @@ npm run jsdoc
The documentation will be placed in the `doc` folder.
### Debugging
## Debugging
* To debug the tests in Webstorm, open the Gulp tab, right click the `test` task, and click `Debug 'test'`.
* To run a single test, change the test function from `it` to `fit`.

View File

@ -3,11 +3,11 @@
var Cesium = require('cesium');
var path = require('path');
var yargs = require('yargs');
var convert = require('../lib/convert');
var obj2gltf = require('../lib/obj2gltf');
var defined = Cesium.defined;
var defaults = convert.defaults;
var defaults = obj2gltf.defaults;
var args = process.argv;
@ -124,7 +124,7 @@ var options = {
console.time('Total');
convert(objPath, gltfPath, options)
obj2gltf(objPath, gltfPath, options)
.then(function() {
console.timeEnd('Total');
})

View File

@ -1 +1 @@
module.exports = require('./lib/convert');
module.exports = require('./lib/obj2gltf');

View File

@ -4,8 +4,8 @@ var path = require('path');
var Promise = require('bluebird');
var ArrayStorage = require('./ArrayStorage');
var loadImage = require('./image');
var loadMtl = require('./mtl');
var loadImage = require('./loadImage');
var loadMtl = require('./loadMtl');
var readLines = require('./readLines');
var ComponentDatatype = Cesium.ComponentDatatype;

View File

@ -4,8 +4,8 @@ var fsExtra = require('fs-extra');
var GltfPipeline = require('gltf-pipeline').Pipeline;
var path = require('path');
var Promise = require('bluebird');
var createGltf = require('./gltf');
var loadObj = require('./obj');
var createGltf = require('./createGltf');
var loadObj = require('./loadObj');
var writeUris = require('./writeUris');
var fsExtraOutputJson = Promise.promisify(fsExtra.outputJson);
@ -14,7 +14,7 @@ var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var DeveloperError = Cesium.DeveloperError;
module.exports = convert;
module.exports = obj2gltf;
/**
* Converts an obj file to a glTF file.
@ -37,8 +37,8 @@ module.exports = convert;
* @param {Boolean} [options.secure=false] Prevent the converter from reading image or mtl files outside of the input obj directory.
* @param {Logger} [options.logger] A callback function for handling logged messages. Defaults to console.log.
*/
function convert(objPath, gltfPath, options) {
var defaults = convert.defaults;
function obj2gltf(objPath, gltfPath, options) {
var defaults = obj2gltf.defaults;
options = defaultValue(options, {});
var binary = defaultValue(options.binary, defaults.binary);
@ -113,7 +113,7 @@ function convert(objPath, gltfPath, options) {
})
.then(function(gltf) {
if (bypassPipeline) {
return convert._outputJson(gltfPath, gltf);
return obj2gltf._outputJson(gltfPath, gltf);
} else {
return GltfPipeline.processJSONToDisk(gltf, gltfPath, pipelineOptions);
}
@ -121,9 +121,9 @@ function convert(objPath, gltfPath, options) {
}
/**
* Default values that will be used when calling convert(options) unless specified in the options object.
* Default values that will be used when calling obj2gltf(options) unless specified in the options object.
*/
convert.defaults = {
obj2gltf.defaults = {
/**
* Gets or sets whether the model will be saved as binary glTF.
* @type Boolean
@ -210,7 +210,7 @@ convert.defaults = {
*
* @private
*/
convert._outputJson = fsExtraOutputJson;
obj2gltf._outputJson = fsExtraOutputJson;
/**
* A callback function that logs messages.

View File

@ -42,6 +42,7 @@
"istanbul": "^0.4.5",
"jasmine": "^2.5.3",
"jasmine-spec-reporter": "^3.2.0",
"jsdoc": "^3.4.3",
"jshint": "^2.9.4",
"jshint-stylish": "^2.2.1",
"open": "^0.0.5",

View File

@ -3,10 +3,10 @@ var Cesium = require('cesium');
var fsExtra = require('fs-extra');
var path = require('path');
var Promise = require('bluebird');
var convert = require('../../lib/convert');
var createGltf = require('../../lib/gltf');
var loadImage = require('../../lib/image');
var loadObj = require('../../lib/obj');
var obj2gltf = require('../../lib/obj2gltf');
var createGltf = require('../../lib/createGltf');
var loadImage = require('../../lib/loadImage');
var loadObj = require('../../lib/loadObj');
var Material = require('../../lib/Material');
var writeUris = require('../../lib/writeUris');
@ -22,7 +22,7 @@ var groupGltfUrl = 'specs/data/box-objects-groups-materials/box-objects-groups-m
var diffuseTextureUrl = 'specs/data/box-textured/cesium.png';
var transparentDiffuseTextureUrl = 'specs/data/box-complex-material/diffuse.png';
var defaultOptions = convert.defaults;
var defaultOptions = obj2gltf.defaults;
var checkTransparencyOptions = clone(defaultOptions);
checkTransparencyOptions.checkTransparency = true;

View File

@ -1,7 +1,7 @@
'use strict';
var Cesium = require('cesium');
var convert = require('../../lib/convert');
var loadImage = require('../../lib/image');
var obj2gltf = require('../../lib/obj2gltf');
var loadImage = require('../../lib/loadImage');
var clone = Cesium.clone;
var WebGLConstants = Cesium.WebGLConstants;
@ -13,7 +13,7 @@ var gifImage = 'specs/data/box-complex-material/ambient.gif';
var grayscaleImage = 'specs/data/box-complex-material/alpha.png';
var transparentImage = 'specs/data/box-complex-material/diffuse.png';
var defaultOptions = convert.defaults;
var defaultOptions = obj2gltf.defaults;
describe('image', function() {
it('loads png image', function(done) {

View File

@ -1,6 +1,6 @@
'use strict';
var path = require('path');
var loadMtl = require('../../lib/mtl');
var loadMtl = require('../../lib/loadMtl');
var complexMaterialUrl = 'specs/data/box-complex-material/box-complex-material.mtl';
var multipleMaterialsUrl = 'specs/data/box-multiple-materials/box-multiple-materials.mtl';

View File

@ -1,19 +1,18 @@
'use strict';
var GltfPipeline = require('gltf-pipeline').Pipeline;
var path = require('path');
var convert = require('../../lib/convert');
var obj2gltf = require('../../lib/obj2gltf');
var writeUris = require('../../lib/writeUris');
var objPath = 'specs/data/box-textured/box-textured.obj';
var gltfPath = 'specs/data/box-textured/box-textured.gltf';
var glbPath = 'specs/data/box-textured/box-textured.glb';
var objPathNonExistent = 'specs/data/non-existent.obj';
var objExternalResourcesPath = 'specs/data/box-external-resources/box-external-resources.obj';
describe('convert', function() {
describe('obj2gltf', function() {
it('converts an obj to gltf', function(done) {
var spy = spyOn(GltfPipeline, 'processJSONToDisk');
expect(convert(objPath, gltfPath)
expect(obj2gltf(objPath, gltfPath)
.then(function() {
var args = spy.calls.first().args;
var gltf = args[0];
@ -26,7 +25,7 @@ describe('convert', function() {
it('uses default gltf-pipeline options', function(done) {
var spy = spyOn(GltfPipeline, 'processJSONToDisk');
expect(convert(objPath, gltfPath)
expect(obj2gltf(objPath, gltfPath)
.then(function() {
var args = spy.calls.first().args;
var options = args[2];
@ -69,10 +68,10 @@ describe('convert', function() {
textureCompressionOptions : textureCompressionOptions,
checkTransparency : true,
secure : true,
logger : convert.defaults.logger
logger : obj2gltf.defaults.logger
};
expect(convert(objPath, gltfPath, options)
expect(obj2gltf(objPath, gltfPath, options)
.then(function() {
var args = spy.calls.first().args;
var options = args[2];
@ -98,7 +97,7 @@ describe('convert', function() {
it('saves as binary if gltfPath has a .glb extension', function(done) {
var spy = spyOn(GltfPipeline, 'processJSONToDisk');
expect(convert(objPath, glbPath)
expect(obj2gltf(objPath, glbPath)
.then(function() {
var args = spy.calls.first().args;
var options = args[2];
@ -107,31 +106,31 @@ describe('convert', function() {
});
it('bypassPipeline flag bypasses gltf-pipeline', function(done) {
spyOn(convert, '_outputJson');
spyOn(obj2gltf, '_outputJson');
spyOn(GltfPipeline, 'processJSONToDisk');
var options = {
bypassPipeline : true
};
expect(convert(objPath, gltfPath, options)
expect(obj2gltf(objPath, gltfPath, options)
.then(function() {
expect(convert._outputJson).toHaveBeenCalled();
expect(obj2gltf._outputJson).toHaveBeenCalled();
expect(GltfPipeline.processJSONToDisk).not.toHaveBeenCalled();
}), done).toResolve();
});
it('rejects if obj path does not exist', function(done) {
expect(convert(objPathNonExistent, gltfPath), done).toRejectWith(Error);
expect(obj2gltf(objPathNonExistent, gltfPath), done).toRejectWith(Error);
});
it('throws if objPath is undefined', function() {
expect(function() {
convert(undefined, gltfPath);
obj2gltf(undefined, gltfPath);
}).toThrowDeveloperError();
});
it('rejects if gltfPath is undefined', function() {
expect(function() {
convert(objPath, undefined);
obj2gltf(objPath, undefined);
}).toThrowDeveloperError();
});
});

View File

@ -2,8 +2,8 @@
var Cesium = require('cesium');
var path = require('path');
var Promise = require('bluebird');
var convert = require('../../lib/convert');
var loadObj = require('../../lib/obj');
var loadObj = require('../../lib/loadObj');
var obj2gltf = require('../../lib/obj2gltf');
var clone = Cesium.clone;
var RuntimeError = Cesium.RuntimeError;
@ -59,7 +59,7 @@ function getImagePath(objPath, relativePath) {
return path.resolve(path.dirname(objPath), relativePath);
}
var defaultOptions = convert.defaults;
var defaultOptions = obj2gltf.defaults;
describe('obj', function() {
it('loads obj with positions, normals, and uvs', function(done) {