How to use the gltf-pipeline.gltfToGlb 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 / createGltf.js View on Github external
'use strict';
var Cesium = require('cesium');
var gltfPipeline = require('gltf-pipeline');
var path = require('path');
var Promise = require('bluebird');
var getBufferPadded = require('./getBufferPadded');

var Cartesian3 = Cesium.Cartesian3;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;

var gltfToGlb = gltfPipeline.gltfToGlb;

module.exports = createGltf;

var rootDirectory = path.join(__dirname, '../');

var sizeOfUint8 = 1;
var sizeOfUint16 = 2;
var sizeOfFloat32 = 4;

/**
 * Create a glTF from a Mesh.
 *
 * @param {Object} options An object with the following properties:
 * @param {Mesh} options.mesh The mesh.
 * @param {Boolean} [options.useBatchIds=true] Modify the glTF to include the batchId vertex attribute.
 * @param {Boolean} [options.relativeToCenter=false] Set mesh positions relative to center.