Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var GltfPipeline = require('gltf-pipeline');
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGltf;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glb The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
*
* @private
*/
function optimizeGltf(glb, options) {
var gltf = parseBinaryGltf(glb);
'use strict';
var Cesium = require('cesium');
var GltfPipeline = require('gltf-pipeline');
var Cartesian3 = Cesium.Cartesian3;
var DeveloperError = Cesium.DeveloperError;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var addCesiumRTC = GltfPipeline.addCesiumRTC;
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGlb;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glbBuffer The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
* @private
*/
function optimizeGlb(glbBuffer, options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
if (!defined(glbBuffer)) {