Metadata-Version: 2.1
Name: al3dtiles
Version: 0.1.21
Summary: High-performance 3D Tiles v1.0/v1.1 reader, parser and converter (Cython + C++)
Author-Email: "Lun.A" <517308447@qq.com>
Requires-Python: >=3.11
Requires-Dist: alktx2>=0.1.6
Requires-Dist: almeshopt>=0.1.11
Requires-Dist: numpy>=2.0.1
Requires-Dist: orjson>=3.9
Requires-Dist: Pillow>=10.0
Requires-Dist: tqdm>=4.66
Requires-Dist: zstandard>=0.22
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Provides-Extra: crs
Requires-Dist: pyproj>=3.0; extra == "crs"
Description-Content-Type: text/markdown

# al3dtiles

High-performance 3D Tiles v1.0/v1.1 reader, parser and converter (Cython + C++).

## Features (v0.1)

- Zero-copy GLB/B3DM container parsing (C++ mmap)
- One-line GLB chunk0 JSON extraction
- Meshopt + KTX2 decompression to Blender-readable GLB (via `almeshopt` + `alktx2`)
- 3D Tiles tileset traversal (v1.0/v1.1, `3DTILES_content_gltf`)
- **C++ multi-threaded tileset JSON prefetch** (`std::thread` pool + simdjson) with thin Python wrappers
- Multi-threaded batch helpers

## Quick start

```python
import al3dtiles as t

t.extract_glb_json("content/1.glb", "out/1.json")
t.decompress_glb("content/1.glb", "out/1_blender.glb")
```

```python
import al3dtiles as t

ds = t.TilesetDataset.open(r"Z:\...\tileset.json")

# 惰性解析：构造时不扫树，首次访问时才加载（C++ 线程池并行预取 JSON）
root = ds.tree(show_progress=True)          # 需要 transform / 树结构时
items = ds.contents()     # 扁平 content 列表（同一 C++ 并行引擎）

# 导出（默认：套用级联 transform，ECEF 真实位置，接近 Cesium）
ds.export_common_glb("4293.glb", r"E:\out\4293_world.glb")

# keep_enu=True：仅 decompress，保持 tile 局部坐标（原逻辑）
ds.export_common_glb("4293.glb", r"E:\out\4293_local.glb", keep_enu=True)
```

```python
import al3dtiles as t

# 质检单体元数据（QC3DMETA v1）：遍历叶子节点 → 每单体 bbox + footprint + 网格桶
# 输出与 tileset.json 同级的 tileset.quality-meta.bin.zst（zstd level 3）
result = t.create_alcheck_metadata(r"D:\Data\...\tileset.json")
print(result.feature_count, result.elapsed_ms)
```

## Build (Windows + Python 3.11)

```powershell
# Vendor simdjson + meshoptimizer (first time only)
powershell -ExecutionPolicy Bypass -File scripts/vendor_simdjson.ps1
powershell -ExecutionPolicy Bypass -File scripts/vendor_meshoptimizer.ps1

chcp 65001
uv sync --extra dev
uv build --wheel --out-dir dist
```

### Build options (`pyproject.toml`)

```toml
[tool.scikit-build.cmake.define]
USE_AVX2 = "ON"    # default
USE_AVX512 = "OFF" # reserved
```

## Test

```powershell
uv run pytest tests/ -v
```

Set `AL3DTILES_TEST_DATA` to override the default test tileset path.

## Dependencies

- Runtime: `alktx2`, `almeshopt`, `numpy`, `orjson`, `zstandard`
- Build: `scikit-build-core`, `Cython`, `ninja`, CMake ≥ 3.20
