Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/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