Updated readme with command line flags

This commit is contained in:
Sean Lilley 2015-10-19 17:38:55 -04:00
parent b37a582723
commit d38b3bc82f
3 changed files with 26 additions and 4 deletions

View File

@ -11,9 +11,31 @@ npm install
```
Run `node ./bin/obj2gltf.js` and pass it the path to an OBJ file.
## Usage
###Command line flags:
|Flag|Description|Required|
|----|-----------|--------|
|`-i`|Path to the input OBJ file.| :white_check_mark: Yes|
|`-o`|Directory or filename for the exported glTF file.|No|
|`-c`|Combine glTF resources, including images, into the exported glTF file.|No, default `false`|
|`-t`|Shading technique. Possible values are `lambert`, `phong`, `blinn`, and `constant`. The shading technique is typically determined by the MTL file, but this is good for more explicit control.|No|
|`-h`|Display help|No|
###Examples:
`node ./bin/obj2gltf.js model.obj`
`node ./bin/obj2gltf.js model.obj model.gltf`
`node ./bin/obj2gltf.js -i model.obj -o model.gltf`
`node ./bin/obj2gltf.js -i model.obj -o model.gltf -c -t phong`
## Limitations
This tool is still in development. We plan on adding additional features like gzip compression, binary glTF export, normal generation, and a testing suite.
This tool is still in development. We plan on adding additional features like gzip compression, binary glTF export, and a testing suite.
Pull requests are appreciated. Please use the same [Contributor License Agreement (CLA)](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md) used for [Cesium](http://cesiumjs.org/).

View File

@ -18,8 +18,8 @@ if (process.argv.length < 3 || defined(argv.h) || defined(argv.help)) {
console.log(' -i, --input Path to obj file');
console.log(' -o, --output Directory or filename for the exported glTF file');
console.log(' -b, --binary Output binary glTF');
console.log(' -c --combine Combine glTF resources into a single file');
console.log(' -t --technique Shading technique. Possible values are lambert, phong, blinn, constant');
console.log(' -c, --combine Combine glTF resources into a single file');
console.log(' -t, --technique Shading technique. Possible values are lambert, phong, blinn, constant');
console.log(' -h, --help Display this help');
process.exit(0);
}

View File

@ -430,7 +430,7 @@ function generateTechnique(gltf, khrMaterialsCommon, attributes, lightParameters
fragmentLightingBlock += ' ambientLight += vec3(0.1, 0.1, 0.1);\n';
}
if (!hasNonAmbientLights) {
if (!hasNonAmbientLights && (lightingModel !== 'CONSTANT')) {
fragmentLightingBlock += ' vec3 l = normalize(czm_sunDirectionEC);\n';
fragmentLightingBlock += ' diffuseLight += vec3(1.0, 1.0, 1.0) * max(dot(normal,l), 0.);\n';