mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2024-11-27 10:30:16 -05:00
Added ao option
This commit is contained in:
parent
4eb0cacc37
commit
ad0866efde
@ -13,6 +13,7 @@ if (process.argv.length < 3 || defined(argv.h) || defined(argv.help)) {
|
||||
console.log(' -b, --binary Output binary glTF');
|
||||
console.log(' -e, --embed Embed glTF resources into a single file');
|
||||
console.log(' -h, --help Display this help');
|
||||
console.log(' --ao Apply ambient occlusion to the converted model');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
@ -21,6 +22,7 @@ var outputPath = defaultValue(argv._[1], defaultValue(argv.o, argv.output));
|
||||
var binary = defaultValue(defaultValue(argv.b, argv.binary), false);
|
||||
var embed = defaultValue(defaultValue(argv.e, argv.embed), false);
|
||||
var quantize = defaultValue(defaultValue(argv.q, argv.quantize), false); // Undocumented option
|
||||
var ao = defaultValue(argv.ao, false);
|
||||
|
||||
if (!defined(objFile)) {
|
||||
throw new Error('-i or --input argument is required. See --help for details.');
|
||||
@ -31,7 +33,8 @@ console.time('Total');
|
||||
var options = {
|
||||
binary : binary,
|
||||
embed : embed,
|
||||
quantize : quantize
|
||||
quantize : quantize,
|
||||
ao : ao
|
||||
};
|
||||
|
||||
convert(objFile, outputPath, options, function() {
|
||||
|
@ -13,6 +13,7 @@ function convert(objFile, outputPath, options, done) {
|
||||
var binary = defaultValue(options.binary, false);
|
||||
var embed = defaultValue(options.embed, true);
|
||||
var quantize = defaultValue(options.quantize, false);
|
||||
var ao = defaultValue(options.ao, false);
|
||||
|
||||
if (!defined(objFile)) {
|
||||
throw new Error('objFile is required');
|
||||
@ -36,10 +37,12 @@ function convert(objFile, outputPath, options, done) {
|
||||
|
||||
parseObj(objFile, inputPath, function(data) {
|
||||
createGltf(data, inputPath, modelName, function(gltf) {
|
||||
var aoOptions = ao ? {} : undefined;
|
||||
var options = {
|
||||
binary : binary,
|
||||
embed : embed,
|
||||
quantize : quantize,
|
||||
aoOptions : aoOptions,
|
||||
createDirectory : false,
|
||||
basePath : inputPath
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user