chore: 初始化glTF模型压缩工具包
添加了完整的项目配置、工具函数、纹理压缩与模型优化实现,以及文档说明
This commit is contained in:
40
README.md
Normal file
40
README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# @g1sir8b/gltf-model-compressor
|
||||
|
||||
用于:
|
||||
|
||||
- 优化 `.gltf` / `.glb`
|
||||
- 自动补全法线和切线
|
||||
- 可选纹理压缩
|
||||
- 输出为 `gltf + buffer.bin` 或 `glb`
|
||||
|
||||
## 构建
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
```ts
|
||||
import optimizeModel from '@g1sir8b/gltf-model-compressor';
|
||||
|
||||
await optimizeModel(
|
||||
'D:/input/model.glb',
|
||||
'D:/output',
|
||||
'medium',
|
||||
true
|
||||
);
|
||||
```
|
||||
|
||||
也支持对象参数:
|
||||
|
||||
```ts
|
||||
import { optimizeModelWithOptions } from '@g1sir8b/gltf-model-compressor';
|
||||
|
||||
await optimizeModelWithOptions({
|
||||
input: 'D:/input/model.gltf',
|
||||
output: 'D:/output',
|
||||
compressTex: 'off',
|
||||
toGLB: false
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user