How to use the @gltf-transform/core.GLTFUtil.removeBufferView function in @gltf-transform/core

To help you get started, we’ve selected a few @gltf-transform/core 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 donmccurdy / glTF-Transform / packages / prune / src / prune.ts View on Github external
}
      }
      if (primitive.indices && duplicateAccessors.has(primitive.indices)) {
        primitive.indices = duplicateAccessors.get(primitive.indices);
      }
    });
  });

  // Clean up.
  const removedAccessors = Array.from(duplicateAccessors).map(([dup, _]) => dup);
  removedAccessors.sort((a, b) => a > b ? -1 : 1); // sort descending
  removedAccessors.forEach((index) => GLTFUtil.removeAccessor(container, index));
  for (let i = container.json.bufferViews.length - 1; i >= 0; i--) {
    const bufferView = container.json.bufferViews[i];
    if (bufferView.byteLength === 0) {
      GLTFUtil.removeBufferView(container, i);
    }
  }

  return container;
}
github donmccurdy / glTF-Transform / packages / split / src / split.ts View on Github external
  removedBufferViews.forEach((index) => GLTFUtil.removeBufferView(container, index));