Added compress flag and updated version number

This commit is contained in:
Sean Lilley 2016-08-25 13:48:34 -04:00
parent 5decc6cee9
commit c79684b10e
5 changed files with 16 additions and 10 deletions

View File

@ -1,6 +1,10 @@
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
* Fixed a bug causing models with no mtl file to not convert.

View File

@ -13,6 +13,7 @@ if (process.argv.length < 3 || defined(argv.h) || defined(argv.help)) {
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(' -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(' --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.');
@ -24,7 +25,7 @@ var outputPath = defaultValue(argv._[1], defaultValue(argv.o, argv.output));
var binary = defaultValue(defaultValue(argv.b, argv.binary), false);
var separate = defaultValue(defaultValue(argv.s, argv.separate), 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 optimizeForCesium = defaultValue(argv.cesium, false);
@ -38,7 +39,7 @@ var options = {
binary : binary,
embed : !separate,
embedImage : !separateImage,
quantize : quantize,
compress : compress,
ao : ao,
optimizeForCesium : optimizeForCesium
};

View File

@ -1,6 +1,6 @@
"use strict";
var path = require('path');
var gltfPipeline = require('gltf-pipeline').gltfPipeline;
var GltfPipeline = require('gltf-pipeline').Pipeline;
var parseObj = require('./obj');
var createGltf = require('./gltf');
var Cesium = require('cesium');
@ -14,7 +14,7 @@ function convert(objFile, outputPath, options) {
var binary = defaultValue(options.binary, false);
var embed = defaultValue(options.embed, 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 optimizeForCesium = defaultValue(options.optimizeForCesium, false);
@ -48,12 +48,13 @@ function convert(objFile, outputPath, options) {
binary: binary,
embed: embed,
embedImage: embedImage,
quantize: quantize,
octEncodeNormals: compress,
quantize: compress,
aoOptions: aoOptions,
optimizeForCesium : optimizeForCesium,
createDirectory: false,
basePath: inputPath
};
return gltfPipeline.processJSONToDisk(gltf, gltfFile, options);
return GltfPipeline.processJSONToDisk(gltf, gltfFile, options);
});
}

View File

@ -1,6 +1,6 @@
{
"name": "obj2gltf",
"version": "0.1.3",
"version": "0.1.4",
"description": "Convert OBJ model format to glTF",
"license": "Apache-2.0",
"contributors": [
@ -31,7 +31,7 @@
"byline": "4.2.1",
"cesium": "1.23.0",
"fs-extra": "0.30.0",
"gltf-pipeline": "0.1.0-alpha3",
"gltf-pipeline": "0.1.0-alpha4",
"yargs": "4.7.1"
},
"devDependencies": {

View File

@ -1,7 +1,7 @@
'use strict';
var Promise = require('bluebird');
var gltfPipeline = require('gltf-pipeline').gltfPipeline;
var GltfPipeline = require('gltf-pipeline').Pipeline;
var path = require('path');
var convert = require('../../lib/convert');
@ -10,7 +10,7 @@ var gltfFile = './specs/data/BoxTextured/BoxTextured.gltf';
describe('convert', function() {
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;
});
expect(convert(objFile, gltfFile, {})