mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2024-11-27 02:24:04 -05:00
Support KHR_materials_common output
This commit is contained in:
parent
c7b4fc3cb1
commit
02c3aa18db
@ -47,6 +47,7 @@ Using obj2gltf as a command-line tool:
|
||||
|`-n`|Generate normals if they are missing.|No, default `false`|
|
||||
|`--cesium`|Optimize the glTF for Cesium by using the sun as a default light source.|No, default `false`|
|
||||
|`--ao`|Apply ambient occlusion to the converted model.|No, default `false`|
|
||||
|`--kmc|Output glTF with the KHR_materials_common extension.|No, default `false`|
|
||||
|`--bypassPipeline`|Bypass the gltf-pipeline for debugging purposes. This option overrides many of the options above and will save the glTF with the KHR_materials_common extension.|No, default `false`|
|
||||
|`--hasTransparency`|Do a more exhaustive check for texture transparency by looking at the alpha channel of each pixel. By default textures with an alpha channel are considered to be transparent.|No, default `false`|
|
||||
|`--secure`|Prevent the converter from reading image or mtl files outside of the input obj directory.|No, default `false`|
|
||||
|
@ -75,6 +75,11 @@ var argv = yargs
|
||||
type: 'boolean',
|
||||
default: false
|
||||
},
|
||||
kmc : {
|
||||
describe: 'Output glTF with the KHR_materials_common extension.',
|
||||
type: 'boolean',
|
||||
default: false
|
||||
},
|
||||
bypassPipeline : {
|
||||
describe: 'Bypass the gltf-pipeline for debugging purposes. This option overrides many of the options above and will save the glTF with the KHR_materials_common extension.',
|
||||
type: 'boolean',
|
||||
|
@ -30,6 +30,7 @@ module.exports = convert;
|
||||
* @param {Boolean} [options.optimizeForCesium=false] Optimize the glTF for Cesium by using the sun as a default light source.
|
||||
* @param {Boolean} [options.generateNormals=false] Generate normals if they are missing.
|
||||
* @param {Boolean} [options.ao=false] Apply ambient occlusion to the converted model.
|
||||
* @param {Boolean} [options.kmc=false] Output glTF with the KHR_materials_common extension.
|
||||
* @param {Boolean} [options.textureCompressionOptions] Options sent to the compressTextures stage of gltf-pipeline.
|
||||
* @param {Boolean} [options.bypassPipeline=false] Bypass the gltf-pipeline for debugging purposes. This option overrides many of the options above and will save the glTF with the KHR_materials_common extension.
|
||||
* @param {Boolean} [options.hasTransparency=false] Do a more exhaustive check for texture transparency by looking at the alpha channel of each pixel.
|
||||
@ -46,6 +47,7 @@ function convert(objPath, gltfPath, options) {
|
||||
var optimizeForCesium = defaultValue(options.optimizeForCesium, false);
|
||||
var generateNormals = defaultValue(options.generateNormals, false);
|
||||
var ao = defaultValue(options.ao, false);
|
||||
var kmc = defaultValue(options.kmc, false);
|
||||
var textureCompressionOptions = options.textureCompressionOptions;
|
||||
var bypassPipeline = defaultValue(options.bypassPipeline, false);
|
||||
var logger = defaultValue(options.logger, defaultLogger);
|
||||
@ -75,6 +77,9 @@ function convert(objPath, gltfPath, options) {
|
||||
|
||||
var aoOptions = ao ? {} : undefined;
|
||||
|
||||
// TODO: gltf-pipeline uses the same kmc options for each material and doesn't recognize the transparent flag
|
||||
var kmcOptions = kmc ? {} : undefined;
|
||||
|
||||
var pipelineOptions = {
|
||||
createDirectory : false,
|
||||
basePath : basePath,
|
||||
@ -88,6 +93,7 @@ function convert(objPath, gltfPath, options) {
|
||||
optimizeForCesium : optimizeForCesium,
|
||||
smoothNormals : generateNormals,
|
||||
aoOptions : aoOptions,
|
||||
kmcOptions : kmcOptions,
|
||||
textureCompressionOptions : textureCompressionOptions
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user