mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-02-17 08:03:55 -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(' -b, --binary Output binary glTF');
|
||||||
console.log(' -e, --embed Embed glTF resources into a single file');
|
console.log(' -e, --embed Embed glTF resources into a single file');
|
||||||
console.log(' -h, --help Display this help');
|
console.log(' -h, --help Display this help');
|
||||||
|
console.log(' --ao Apply ambient occlusion to the converted model');
|
||||||
process.exit(0);
|
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 binary = defaultValue(defaultValue(argv.b, argv.binary), false);
|
||||||
var embed = defaultValue(defaultValue(argv.e, argv.embed), false);
|
var embed = defaultValue(defaultValue(argv.e, argv.embed), false);
|
||||||
var quantize = defaultValue(defaultValue(argv.q, argv.quantize), false); // Undocumented option
|
var quantize = defaultValue(defaultValue(argv.q, argv.quantize), false); // Undocumented option
|
||||||
|
var ao = defaultValue(argv.ao, false);
|
||||||
|
|
||||||
if (!defined(objFile)) {
|
if (!defined(objFile)) {
|
||||||
throw new Error('-i or --input argument is required. See --help for details.');
|
throw new Error('-i or --input argument is required. See --help for details.');
|
||||||
@ -31,7 +33,8 @@ console.time('Total');
|
|||||||
var options = {
|
var options = {
|
||||||
binary : binary,
|
binary : binary,
|
||||||
embed : embed,
|
embed : embed,
|
||||||
quantize : quantize
|
quantize : quantize,
|
||||||
|
ao : ao
|
||||||
};
|
};
|
||||||
|
|
||||||
convert(objFile, outputPath, options, function() {
|
convert(objFile, outputPath, options, function() {
|
||||||
|
@ -13,6 +13,7 @@ function convert(objFile, outputPath, options, done) {
|
|||||||
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 quantize = defaultValue(options.quantize, false);
|
var quantize = defaultValue(options.quantize, false);
|
||||||
|
var ao = defaultValue(options.ao, false);
|
||||||
|
|
||||||
if (!defined(objFile)) {
|
if (!defined(objFile)) {
|
||||||
throw new Error('objFile is required');
|
throw new Error('objFile is required');
|
||||||
@ -36,10 +37,12 @@ function convert(objFile, outputPath, options, done) {
|
|||||||
|
|
||||||
parseObj(objFile, inputPath, function(data) {
|
parseObj(objFile, inputPath, function(data) {
|
||||||
createGltf(data, inputPath, modelName, function(gltf) {
|
createGltf(data, inputPath, modelName, function(gltf) {
|
||||||
|
var aoOptions = ao ? {} : undefined;
|
||||||
var options = {
|
var options = {
|
||||||
binary : binary,
|
binary : binary,
|
||||||
embed : embed,
|
embed : embed,
|
||||||
quantize : quantize,
|
quantize : quantize,
|
||||||
|
aoOptions : aoOptions,
|
||||||
createDirectory : false,
|
createDirectory : false,
|
||||||
basePath : inputPath
|
basePath : inputPath
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user