🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@gltf-transform/cli

Package Overview
Dependencies
Maintainers
1
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gltf-transform/cli - npm Package Compare versions

Comparing version
0.0.7
to
0.0.11
+21
LICENSE
The MIT License (MIT)
Copyright (c) 2018 Don McCurdy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const gl = require('gl');
const { createCanvas, Image } = require('canvas');
const program = require('caporal');
const { version } = require('../package.json');
const { GLTFUtil, NodeIO } = require('@gltf-transform/core');
const { ao } = require('@gltf-transform/ao');
const { atlas } = require('@gltf-transform/atlas');
const { colorspace } = require('@gltf-transform/colorspace');
const { split } = require('@gltf-transform/split');
const { prune } = require('@gltf-transform/prune');
const io = new NodeIO(fs, path);
program
.version(version);
// ANALYZE
program
.command('analyze', 'Analyzes a model\'s contents')
.argument('<input>', 'Path to glTF 2.0 (.glb, .gltf) model')
.action(({input}, options, logger) => {
const container = io.read(input);
const analysis = GLTFUtil.analyze(container);
logger.info(JSON.stringify(analysis, null, 2));
});
// AMBIENT OCCLUSION
program
.command('ao', 'Bakes per-vertex ambient occlusion')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.option('--resolution <n>', 'AO resolution', program.INT, 512)
.option('--samples <n>', 'Number of samples', program.INT, 500)
.action(({input, output}, {resolution, samples}, logger) => {
const container = io.read(input);
ao(container, {gl, resolution, samples});
io.write(output, container);
});
// ATLAS
program
.command('atlas', 'Creates a texture atlas with simple rectangular packing')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.option('--size [size]', 'Atlas size', program.INT)
.option('--bake [bakeUVs]', 'If set, bakes transformed UVs to meshes. '
+ 'Otherwise, adds UV transforms to each material.', program.BOOL)
.action(({input, output}, {size, bake}, logger) => {
const container = io.read(input);
atlas(container, {size, bake, createCanvas, createImage: () => new Image()}).then(() => {
io.write(output, container);
}).catch((e) => {
logger.error(e);
});
});
// COLORSPACE
program
.command('colorspace', 'Colorspace correction for vertex colors')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.option('--inputEncoding [inputEncoding]', 'Input encoding for existing vertex colors', program.STRING)
.action(({input, output}, {inputEncoding}, logger) => {
const container = io.read(input);
colorspace(container, {inputEncoding});
io.write(output, container);
});
// PRUNE
program
.command('prune', 'Prunes duplicate accessors')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.action(({input, output}, {meshes}) => {
const container = io.read(input);
prune(container, meshes);
io.write(output, container);
});
// SPLIT
program
.command('split', 'Splits buffers so that separate meshes can be stored in separate .bin files')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.option('--meshes [meshes]', 'Mesh names', program.LIST)
.action(({input, output}, {meshes}) => {
const container = io.read(input);
split(container, meshes);
io.write(output, container);
});
// PACK:TODO
program
.parse(process.argv);
+9
-8
{
"name": "@gltf-transform/cli",
"version": "0.0.7",
"version": "0.0.11",
"repository": "github:donmccurdy/glTF-Transform",
"description": "CLI interface to glTF Transform",
"main": "src/index.js",
"main": "src/cli.js",
"bin": {
"gltf-transform": "src/index.js"
"gltf-transform": "src/cli.js"
},

@@ -18,6 +18,6 @@ "scripts": {},

"dependencies": {
"@gltf-transform/ao": "^0.0.7",
"@gltf-transform/core": "^0.0.7",
"@gltf-transform/prune": "^0.0.7",
"@gltf-transform/split": "^0.0.7",
"@gltf-transform/ao": "^0.0.11",
"@gltf-transform/core": "^0.0.11",
"@gltf-transform/prune": "^0.0.11",
"@gltf-transform/split": "^0.0.11",
"caporal": "^1.1.0",

@@ -31,3 +31,4 @@ "gl": "^4.1.1"

"package-lock.json"
]
],
"gitHead": "04304104092dc8638f850d3353c1410f9d0f0cbc"
}
#!/usr/bin/env node
const fs = require('fs');
const gl = require('gl');
const path = require('path');
const program = require('caporal');
const { version } = require('../package.json');
const { GLTFUtil, NodeIO } = require('@gltf-transform/core');
const { ao } = require('@gltf-transform/ao');
const { split } = require('@gltf-transform/split');
const { prune } = require('@gltf-transform/prune');
const io = new NodeIO(fs, path);
program
.version(version);
// ANALYZE
program
.command('analyze', 'Analyzes a model\'s contents')
.argument('<input>', 'Path to glTF 2.0 (.glb, .gltf) model')
.action(({input}, options, logger) => {
const container = io.read(input);
const analysis = GLTFUtil.analyze(container);
logger.info(JSON.stringify(analysis, null, 2));
});
// AMBIENT OCCLUSION
program
.command('ao', 'Bakes per-vertex ambient occlusion')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.option('--resolution <n>', 'AO resolution', program.INT, 512)
.option('--samples <n>', 'Number of samples', program.INT, 500)
.action(({input, output}, {resolution, samples}, logger) => {
const container = io.read(input);
ao(container, {gl, resolution, samples});
io.write(output, container);
});
// PRUNE
program
.command('prune', 'Prunes duplicate accessors')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.action(({input, output}, {meshes}) => {
const container = io.read(input);
prune(container, meshes);
io.write(output, container);
});
// SPLIT
program
.command('split', 'Splits buffers so that separate meshes can be stored in separate .bin files')
.argument('<input>', 'Path to read glTF 2.0 (.glb, .gltf) input')
.argument('<output>', 'Path to write output')
.option('--meshes [meshes]', 'Mesh names', program.LIST)
.action(({input, output}, {meshes}) => {
const container = io.read(input);
split(container, meshes);
io.write(output, container);
});
// PACK:TODO
// ATLAS:TODO
program
.parse(process.argv);

Sorry, the diff of this file is too big to display