- Notifications
You must be signed in to change notification settings - Fork3
likangning93/OBJ2GLTF
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Convert OBJ assets toglTF 1.0.
InstallNode.js if you don't already have it, and then:
npm install --save obj2gltf
Using obj2gltf as a library:
varobj2gltf=require('obj2gltf');varconvert=obj2gltf.convert;varoptions={embedImage :false// Don't embed image in the converted glTF}convert('model.obj','model.gltf',options).then(function(){console.log('Converted model');});
Using obj2gltf as a command-line tool:
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 -s
###Command line flags:
Flag | Description | Required |
---|---|---|
-i | Path to the input OBJ file. | ✅ Yes |
-o | Directory or filename for the exported glTF file. | No |
-b | Output binary glTF. | No, defaultfalse |
-s | Writes out separate geometry/animation data files, shader files, and textures instead of embedding them in the glTF file. | No, defaultfalse |
-t | Write out separate textures only. | No, defaultfalse |
--ao | Apply ambient occlusion to the converted model. | No, defaultfalse |
-h | Display help | No |
Run the tests:
npm run test
To run JSHint on the entire codebase, run:
npm run jsHint
To run JSHint automatically when a file is saved, run the following and leave it open in a console window:
npm run jsHint-watch
Coverage usesistanbul. Run:
npm run coverage
For complete coverage details, opencoverage/lcov-report/index.html
.
The tests and coverage covers the Node.js module; it does not cover the command-line interface, which is tiny.
To generate the documentation:
npm run jsdoc
The documentation will be placed in thedoc
folder.
- To debug the tests in Webstorm, open the Gulp tab, right click the
test
task, and clickDebug 'test'
. - To run a single test, change the test function from
it
tofit
.
Pull requests are appreciated. Please use the sameContributor License Agreement (CLA) used forCesium.
Developed by the Cesium team.