How to use the gltf-pipeline.Pipeline function in gltf-pipeline

To help you get started, weā€™ve selected a few gltf-pipeline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AnalyticalGraphicsInc / 3d-tiles-tools / samples-generator / lib / optimizeGltf.js View on Github external
'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);
    return loadGltfUris(gltf)
        .then(function() {
github AnalyticalGraphicsInc / 3d-tiles-tools / tools / lib / optimizeGlb.js View on Github external
'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)) {
        throw new DeveloperError('glbBuffer is not defined.');
    }