mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-03-03 06:51:43 -05:00
Merge pull request #78 from AnalyticalGraphicsInc/update-npm
Update npm dependencies
This commit is contained in:
commit
b8ecde6e13
@ -5,8 +5,6 @@ var path = require('path');
|
|||||||
var PNG = require('pngjs').PNG;
|
var PNG = require('pngjs').PNG;
|
||||||
var Promise = require('bluebird');
|
var Promise = require('bluebird');
|
||||||
|
|
||||||
var fsExtraReadFile = Promise.promisify(fsExtra.readFile);
|
|
||||||
|
|
||||||
var defined = Cesium.defined;
|
var defined = Cesium.defined;
|
||||||
var WebGLConstants = Cesium.WebGLConstants;
|
var WebGLConstants = Cesium.WebGLConstants;
|
||||||
|
|
||||||
@ -23,7 +21,7 @@ module.exports = loadImage;
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
function loadImage(imagePath, options) {
|
function loadImage(imagePath, options) {
|
||||||
return fsExtraReadFile(imagePath)
|
return fsExtra.readFile(imagePath)
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
var extension = path.extname(imagePath).toLowerCase();
|
var extension = path.extname(imagePath).toLowerCase();
|
||||||
|
|
||||||
|
@ -10,8 +10,6 @@ var createGltf = require('./createGltf');
|
|||||||
var loadObj = require('./loadObj');
|
var loadObj = require('./loadObj');
|
||||||
var writeUris = require('./writeUris');
|
var writeUris = require('./writeUris');
|
||||||
|
|
||||||
var fsExtraOutputJson = Promise.promisify(fsExtra.outputJson);
|
|
||||||
|
|
||||||
var defaultValue = Cesium.defaultValue;
|
var defaultValue = Cesium.defaultValue;
|
||||||
var defined = Cesium.defined;
|
var defined = Cesium.defined;
|
||||||
var DeveloperError = Cesium.DeveloperError;
|
var DeveloperError = Cesium.DeveloperError;
|
||||||
@ -121,7 +119,7 @@ function obj2gltf(objPath, gltfPath, options) {
|
|||||||
})
|
})
|
||||||
.then(function(gltf) {
|
.then(function(gltf) {
|
||||||
if (bypassPipeline) {
|
if (bypassPipeline) {
|
||||||
return obj2gltf._outputJson(gltfPath, gltf);
|
return fsExtra.outputJson(gltfPath, gltf);
|
||||||
} else {
|
} else {
|
||||||
return GltfPipeline.processJSONToDisk(gltf, gltfPath, pipelineOptions);
|
return GltfPipeline.processJSONToDisk(gltf, gltfPath, pipelineOptions);
|
||||||
}
|
}
|
||||||
@ -237,13 +235,6 @@ obj2gltf.defaults = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Exposed for testing
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
obj2gltf._outputJson = fsExtraOutputJson;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exposed for testing
|
* Exposed for testing
|
||||||
*
|
*
|
||||||
|
@ -5,8 +5,6 @@ var mime = require('mime');
|
|||||||
var path = require('path');
|
var path = require('path');
|
||||||
var Promise = require('bluebird');
|
var Promise = require('bluebird');
|
||||||
|
|
||||||
var fsExtraOutputFile = Promise.promisify(fsExtra.outputFile);
|
|
||||||
|
|
||||||
var RuntimeError = Cesium.RuntimeError;
|
var RuntimeError = Cesium.RuntimeError;
|
||||||
|
|
||||||
module.exports = writeUris;
|
module.exports = writeUris;
|
||||||
@ -88,7 +86,7 @@ function writeSeparateBuffer(gltf, resourcesDirectory, name) {
|
|||||||
var bufferUri = name + '.bin';
|
var bufferUri = name + '.bin';
|
||||||
buffer.uri = bufferUri;
|
buffer.uri = bufferUri;
|
||||||
var bufferPath = path.join(resourcesDirectory, bufferUri);
|
var bufferPath = path.join(resourcesDirectory, bufferUri);
|
||||||
return writeUris._outputFile(bufferPath, source);
|
return fsExtra.outputFile(bufferPath, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeSeparateTextures(gltf, resourcesDirectory) {
|
function writeSeparateTextures(gltf, resourcesDirectory) {
|
||||||
@ -99,7 +97,7 @@ function writeSeparateTextures(gltf, resourcesDirectory) {
|
|||||||
var imageUri = image.name + extras.extension;
|
var imageUri = image.name + extras.extension;
|
||||||
image.uri = imageUri;
|
image.uri = imageUri;
|
||||||
var imagePath = path.join(resourcesDirectory, imageUri);
|
var imagePath = path.join(resourcesDirectory, imageUri);
|
||||||
return writeUris._outputFile(imagePath, extras.source);
|
return fsExtra.outputFile(imagePath, extras.source);
|
||||||
}, {concurrency : 10});
|
}, {concurrency : 10});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,10 +117,3 @@ function writeEmbeddedTextures(gltf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Exposed for testing.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
writeUris._outputFile = fsExtraOutputFile;
|
|
||||||
|
@ -29,12 +29,12 @@
|
|||||||
"bluebird": "^3.4.7",
|
"bluebird": "^3.4.7",
|
||||||
"cesium": "^1.31.0",
|
"cesium": "^1.31.0",
|
||||||
"event-stream": "^3.3.4",
|
"event-stream": "^3.3.4",
|
||||||
"fs-extra": "^2.0.0",
|
"fs-extra": "^3.0.1",
|
||||||
"gltf-pipeline": "^0.1.0-alpha11",
|
"gltf-pipeline": "^0.1.0-alpha11",
|
||||||
"mime": "^1.3.4",
|
"mime": "^1.3.4",
|
||||||
"pngjs": "^3.0.1",
|
"pngjs": "^3.0.1",
|
||||||
"uuid": "^3.0.1",
|
"uuid": "^3.0.1",
|
||||||
"yargs": "^7.0.1"
|
"yargs": "^8.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coveralls": "^2.12.0",
|
"coveralls": "^2.12.0",
|
||||||
@ -42,7 +42,7 @@
|
|||||||
"gulp-jshint": "^2.0.4",
|
"gulp-jshint": "^2.0.4",
|
||||||
"istanbul": "^0.4.5",
|
"istanbul": "^0.4.5",
|
||||||
"jasmine": "^2.5.3",
|
"jasmine": "^2.5.3",
|
||||||
"jasmine-spec-reporter": "^3.2.0",
|
"jasmine-spec-reporter": "^4.1.0",
|
||||||
"jsdoc": "^3.4.3",
|
"jsdoc": "^3.4.3",
|
||||||
"jshint": "^2.9.4",
|
"jshint": "^2.9.4",
|
||||||
"jshint-stylish": "^2.2.1",
|
"jshint-stylish": "^2.2.1",
|
||||||
|
@ -13,8 +13,6 @@ var writeUris = require('../../lib/writeUris');
|
|||||||
var clone = Cesium.clone;
|
var clone = Cesium.clone;
|
||||||
var WebGLConstants = Cesium.WebGLConstants;
|
var WebGLConstants = Cesium.WebGLConstants;
|
||||||
|
|
||||||
var fsExtraReadJson = Promise.promisify(fsExtra.readJson);
|
|
||||||
|
|
||||||
var boxObjUrl = 'specs/data/box/box.obj';
|
var boxObjUrl = 'specs/data/box/box.obj';
|
||||||
var groupObjUrl = 'specs/data/box-objects-groups-materials/box-objects-groups-materials.obj';
|
var groupObjUrl = 'specs/data/box-objects-groups-materials/box-objects-groups-materials.obj';
|
||||||
var boxGltfUrl = 'specs/data/box/box.gltf';
|
var boxGltfUrl = 'specs/data/box/box.gltf';
|
||||||
@ -49,11 +47,11 @@ describe('createGltf', function() {
|
|||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
groupObjData = data;
|
groupObjData = data;
|
||||||
}),
|
}),
|
||||||
fsExtraReadJson(boxGltfUrl)
|
fsExtra.readJson(boxGltfUrl)
|
||||||
.then(function(gltf) {
|
.then(function(gltf) {
|
||||||
boxGltf = gltf;
|
boxGltf = gltf;
|
||||||
}),
|
}),
|
||||||
fsExtraReadJson(groupGltfUrl)
|
fsExtra.readJson(groupGltfUrl)
|
||||||
.then(function(gltf) {
|
.then(function(gltf) {
|
||||||
groupGltf = gltf;
|
groupGltf = gltf;
|
||||||
}),
|
}),
|
||||||
|
@ -19,8 +19,8 @@ describe('obj2gltf', function() {
|
|||||||
expect(obj2gltf._getTempDirectory()).toContain(os.tmpdir());
|
expect(obj2gltf._getTempDirectory()).toContain(os.tmpdir());
|
||||||
tempDirectory = path.join(os.tmpdir(), 'testPath');
|
tempDirectory = path.join(os.tmpdir(), 'testPath');
|
||||||
spyOn(obj2gltf, '_getTempDirectory').and.returnValue(tempDirectory);
|
spyOn(obj2gltf, '_getTempDirectory').and.returnValue(tempDirectory);
|
||||||
spyOn(obj2gltf, '_outputJson');
|
spyOn(fsExtra, 'outputJson');
|
||||||
spyOn(writeUris, '_outputFile');
|
spyOn(fsExtra, 'outputFile');
|
||||||
spyOn(fsExtra, 'remove');
|
spyOn(fsExtra, 'remove');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ describe('obj2gltf', function() {
|
|||||||
textureCompressionOptions : textureCompressionOptions,
|
textureCompressionOptions : textureCompressionOptions,
|
||||||
preserve : false
|
preserve : false
|
||||||
});
|
});
|
||||||
expect(writeUris._outputFile.calls.count()).toBe(2); // Saves out .png and .bin
|
expect(fsExtra.outputFile.calls.count()).toBe(2); // Saves out .png and .bin
|
||||||
}), done).toResolve();
|
}), done).toResolve();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ describe('obj2gltf', function() {
|
|||||||
};
|
};
|
||||||
expect(obj2gltf(objPath, gltfPath, options)
|
expect(obj2gltf(objPath, gltfPath, options)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
expect(obj2gltf._outputJson).toHaveBeenCalled();
|
expect(fsExtra.outputJson).toHaveBeenCalled();
|
||||||
expect(GltfPipeline.processJSONToDisk).not.toHaveBeenCalled();
|
expect(GltfPipeline.processJSONToDisk).not.toHaveBeenCalled();
|
||||||
}), done).toResolve();
|
}), done).toResolve();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user