mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-03-03 06:51:43 -05:00
Merge pull request #23 from AnalyticalGraphicsInc/upgrade
Added compress flag and updated version number
This commit is contained in:
commit
99a5e87623
@ -1,6 +1,10 @@
|
|||||||
Change Log
|
Change Log
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
### 0.1.4 2016-08-25
|
||||||
|
|
||||||
|
* Added compression flag for quantizing positions, compressing texture coordinates, and oct-encoding normals.
|
||||||
|
|
||||||
### 0.1.3 - 2016-08-08
|
### 0.1.3 - 2016-08-08
|
||||||
|
|
||||||
* Fixed a bug causing models with no mtl file to not convert.
|
* Fixed a bug causing models with no mtl file to not convert.
|
||||||
|
@ -13,6 +13,7 @@ if (process.argv.length < 3 || defined(argv.h) || defined(argv.help)) {
|
|||||||
console.log(' -b, --binary Output binary glTF');
|
console.log(' -b, --binary Output binary glTF');
|
||||||
console.log(' -s --separate Writes out separate geometry/animation data files, shader files, and textures instead of embedding them in the glTF file.');
|
console.log(' -s --separate Writes out separate geometry/animation data files, shader files, and textures instead of embedding them in the glTF file.');
|
||||||
console.log(' -t --separateImage Write out separate textures only.');
|
console.log(' -t --separateImage Write out separate textures only.');
|
||||||
|
console.log(' -c --compress Quantize positions, compress texture coordinates, and oct-encode normals.');
|
||||||
console.log(' -h, --help Display this help');
|
console.log(' -h, --help Display this help');
|
||||||
console.log(' --ao Apply ambient occlusion to the converted model');
|
console.log(' --ao Apply ambient occlusion to the converted model');
|
||||||
console.log(' --cesium Optimize the glTF for Cesium by using the sun as a default light source.');
|
console.log(' --cesium Optimize the glTF for Cesium by using the sun as a default light source.');
|
||||||
@ -24,7 +25,7 @@ var outputPath = defaultValue(argv._[1], defaultValue(argv.o, argv.output));
|
|||||||
var binary = defaultValue(defaultValue(argv.b, argv.binary), false);
|
var binary = defaultValue(defaultValue(argv.b, argv.binary), false);
|
||||||
var separate = defaultValue(defaultValue(argv.s, argv.separate), false);
|
var separate = defaultValue(defaultValue(argv.s, argv.separate), false);
|
||||||
var separateImage = defaultValue(defaultValue(argv.t, argv.separateImage), false);
|
var separateImage = defaultValue(defaultValue(argv.t, argv.separateImage), false);
|
||||||
var quantize = defaultValue(defaultValue(argv.q, argv.quantize), false); // Undocumented option
|
var compress = defaultValue(defaultValue(argv.c, argv.compress), false);
|
||||||
var ao = defaultValue(argv.ao, false);
|
var ao = defaultValue(argv.ao, false);
|
||||||
var optimizeForCesium = defaultValue(argv.cesium, false);
|
var optimizeForCesium = defaultValue(argv.cesium, false);
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ var options = {
|
|||||||
binary : binary,
|
binary : binary,
|
||||||
embed : !separate,
|
embed : !separate,
|
||||||
embedImage : !separateImage,
|
embedImage : !separateImage,
|
||||||
quantize : quantize,
|
compress : compress,
|
||||||
ao : ao,
|
ao : ao,
|
||||||
optimizeForCesium : optimizeForCesium
|
optimizeForCesium : optimizeForCesium
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var gltfPipeline = require('gltf-pipeline').gltfPipeline;
|
var GltfPipeline = require('gltf-pipeline').Pipeline;
|
||||||
var parseObj = require('./obj');
|
var parseObj = require('./obj');
|
||||||
var createGltf = require('./gltf');
|
var createGltf = require('./gltf');
|
||||||
var Cesium = require('cesium');
|
var Cesium = require('cesium');
|
||||||
@ -14,7 +14,7 @@ function convert(objFile, outputPath, options) {
|
|||||||
var binary = defaultValue(options.binary, false);
|
var binary = defaultValue(options.binary, false);
|
||||||
var embed = defaultValue(options.embed, true);
|
var embed = defaultValue(options.embed, true);
|
||||||
var embedImage = defaultValue(options.embedImage, true);
|
var embedImage = defaultValue(options.embedImage, true);
|
||||||
var quantize = defaultValue(options.quantize, false);
|
var compress = defaultValue(options.compress, false);
|
||||||
var ao = defaultValue(options.ao, false);
|
var ao = defaultValue(options.ao, false);
|
||||||
var optimizeForCesium = defaultValue(options.optimizeForCesium, false);
|
var optimizeForCesium = defaultValue(options.optimizeForCesium, false);
|
||||||
|
|
||||||
@ -48,12 +48,13 @@ function convert(objFile, outputPath, options) {
|
|||||||
binary: binary,
|
binary: binary,
|
||||||
embed: embed,
|
embed: embed,
|
||||||
embedImage: embedImage,
|
embedImage: embedImage,
|
||||||
quantize: quantize,
|
octEncodeNormals: compress,
|
||||||
|
quantize: compress,
|
||||||
aoOptions: aoOptions,
|
aoOptions: aoOptions,
|
||||||
optimizeForCesium : optimizeForCesium,
|
optimizeForCesium : optimizeForCesium,
|
||||||
createDirectory: false,
|
createDirectory: false,
|
||||||
basePath: inputPath
|
basePath: inputPath
|
||||||
};
|
};
|
||||||
return gltfPipeline.processJSONToDisk(gltf, gltfFile, options);
|
return GltfPipeline.processJSONToDisk(gltf, gltfFile, options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "obj2gltf",
|
"name": "obj2gltf",
|
||||||
"version": "0.1.3",
|
"version": "0.1.4",
|
||||||
"description": "Convert OBJ model format to glTF",
|
"description": "Convert OBJ model format to glTF",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
@ -31,7 +31,7 @@
|
|||||||
"byline": "4.2.1",
|
"byline": "4.2.1",
|
||||||
"cesium": "1.23.0",
|
"cesium": "1.23.0",
|
||||||
"fs-extra": "0.30.0",
|
"fs-extra": "0.30.0",
|
||||||
"gltf-pipeline": "0.1.0-alpha3",
|
"gltf-pipeline": "0.1.0-alpha4",
|
||||||
"yargs": "4.7.1"
|
"yargs": "4.7.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
var Promise = require('bluebird');
|
var Promise = require('bluebird');
|
||||||
|
|
||||||
var gltfPipeline = require('gltf-pipeline').gltfPipeline;
|
var GltfPipeline = require('gltf-pipeline').Pipeline;
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var convert = require('../../lib/convert');
|
var convert = require('../../lib/convert');
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ var gltfFile = './specs/data/BoxTextured/BoxTextured.gltf';
|
|||||||
|
|
||||||
describe('convert', function() {
|
describe('convert', function() {
|
||||||
it('converts an obj to gltf', function(done) {
|
it('converts an obj to gltf', function(done) {
|
||||||
var spy = spyOn(gltfPipeline, 'processJSONToDisk').and.callFake(function(gltf, outputPath, options, callback) {
|
var spy = spyOn(GltfPipeline, 'processJSONToDisk').and.callFake(function(gltf, outputPath, options, callback) {
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
expect(convert(objFile, gltfFile, {})
|
expect(convert(objFile, gltfFile, {})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user