Metadata-Version: 2.4
Name: obj2tiles
Version: 0.1.0
Summary: Convert OBJ to Cesium 3D Tiles (B3DM + tileset.json)
License-Expression: MIT
Keywords: 3d,tiles,obj,cesium,3d-tiles
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Provides-Extra: texture
Requires-Dist: Pillow; extra == "texture"
Dynamic: license-file

# obj2tiles — OBJ → Cesium 3D Tiles

将大型 OBJ 三维模型转换为 Cesium 3D Tiles 格式（B3DM + tileset.json），适用于 CesiumJS 等 3D 地图/地球场景加载。

## 安装

```bash
# 从 PyPI 安装
pip install obj2tiles

# 处理纹理的可选依赖（自动缩放大纹理到 2048 以内）
pip install obj2tiles[texture]

# 本地开发安装
cd obj2tiles && pip install -e .
```

### 前置依赖

编码需要 `draco_encoder` 命令行工具：

```bash
# macOS
brew install draco

# Linux（从 Draco GitHub Release 下载）
# https://github.com/google/draco/releases
```

> `draco_encoder` 不是 Python 包，需要单独安装。运行时缺少它会给出提示。

## 用法

```bash
# 基本用法（本地坐标系）
obj2tiles model.obj ./output

# 指定地理位置（例如龙门石窟大佛）
obj2tiles model.obj ./output --lon 112.47 --lat 34.56

# 控制精度/大小
obj2tiles model.obj ./output --pos-bits 12 --compress 7 --levels 5
```

## 输出结构

```
output/
├── tileset.json       Cesium 3D Tiles 清单文件
├── metadata.json      处理统计信息
├── index.html         CesiumJS 查看器页面
├── lod_0.b3dm         最粗糙 LOD 层级
├── lod_1.b3dm
├── ...
└── lod_N.b3dm         最精细 LOD 层级
```

## 查看方式

```bash
cd output && python -m http.server 8080
# 打开 http://localhost:8080
```
