CesiumGS / gltf-pipeline

Content pipeline tools for optimizing glTF assets. :globe_with_meridians:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Converting to binary file with library

iiLearner opened this issue · comments

Hi,

I'm trying to convert a gltf model into glb binary model, while this works well with cli by passing -b, it does not seem to be working with library. I'm probably missing a flag or something similar. The produced the glb is less than 1mb of size, while processed glb with cli is about 8mb (rightfully). What am I missing?

const options = {
    resourceDirectory: productPath,
    outputName: `${productPath}${modelName}.glb`,
  }

  const gltfToGlb = gltfPipeline.gltfToGlb
  const gltf = fsExtra.readJsonSync(`${productPath}/${gltfFile}`)
  await gltfToGlb(gltf, options).then(function (results: any) {
    fsExtra.outputFile(options.outputName, results.glb)
  })