# gltf-merge

> 一个用于 gltf 合并的工具，适用于模型换材质换网格的场景

Latest version **1.0.1** (published 2021-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install gltf-merge
pnpm add gltf-merge
yarn add gltf-merge
bun add gltf-merge
```

Provides the command `gltf-merge`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-05-19 |
| First published | 2021-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 14.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 15 |
| Author | DeepKolos |
| Maintainers | deepkolos |
| Keywords | gltf, glb |

## Links

- npm: https://www.npmjs.com/package/gltf-merge
- Repository: https://github.com/deepkolos/gltf-merge
- Homepage: https://github.com/deepkolos/gltf-merge#readme
- Issues: https://github.com/deepkolos/gltf-merge/issues
- npm.io page: https://npm.io/package/gltf-merge

## Dependencies (1)

- [gltf-pipeline](https://npm.io/package/gltf-pipeline.md) ^3.0.2

## Recent versions

- 1.0.1 (latest) — 2021-05-19
- 1.0.0 — 2021-05-19

## README

# gltf-merge

一个用于 多个 gltf 依赖资源合并的工具，适用于换材质、换网格，并且不同组合需要按需下载的场景

> 合并输入的 gltf/glb 的之间所包含的 buffers 和 images，让其指向同一个文件
> 并非把多个 gltf/glb 合成一个，如果想找这个，可用[gltf-transform](https://gltf-transform.donmccurdy.com/cli.html)

## 适用场景

<div>
  <img src="https://raw.githubusercontent.com/deepkolos/gltf-merge/master/demo.gif" width="250" alt="" />
</div>

## 命令行使用

```sh
> npm i gltf-merge -S
> gltf-merge -h
```

## NPM 包 使用

不仅仅复用文件，也复用已经上传到 `WebGL` 的纹理，减少切换模型时上传纹理耗时

```js
import { GLTFLoader } from 'three-platfromzie/examples/jsm/loaders/GLTFLoader';
import GLTFMerge from 'gltf-merge';

const gltfMerge = new GLTFMerge();
const gltfLoader = new GLTFLoader();

gltfLoader.loadAsync('test.glb').then(gltf => {
  gltf.scene.traverse(gltfMerge.updateSharedTexture);
});

// 结束使用后
gltfMerge.dispose();
```

## TODO

0. 集成常用的压缩选项 meshopt 和 draco

---
_Source: https://npm.io/package/gltf-merge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
