doc: add official project proposal document 申报书.md
A high-performance, lightweight glTF 2.0 and GLB asset parsing, validation, and optimization tool library written in pure MoonBit.
Add this dependency to your moon.mod:
moon.mod
import { "username/moonbit-gltf-tools": "0.1.0" }
fn main { let json_str = #|{ #| "asset": { "version": "2.0" }, #| "scenes": [{ "nodes": [0] }], #| "nodes": [{ "mesh": 0, "name": "RootNode" }], #| "meshes": [{ #| "primitives": [{ "attributes": { "POSITION": 0 } }] #| }], #| "accessors": [{ "componentType": 5126, "count": 24, "type": "VEC3" }] #|} // Parse glTF JSON let doc = @gltf.parse_gltf_string(json_str) // Validate model structure let validation = @gltf.validate_document(doc) println("Is valid: \{validation.is_valid}") // Generate optimization report let opt_report = @gltf.analyze_optimization(doc) println("Total Vertices: \{opt_report.total_vertices}") println("Draw Calls: \{opt_report.draw_calls}") println("Suggestions: \{to_repr(opt_report.suggestions)}") }
fn process_glb(glb_bytes : Bytes) { let unpacked = @gltf.unpack_glb(glb_bytes) let doc = @gltf.parse_gltf_string(unpacked.json_str) println("glTF Version: \{doc.version}") }
To run the command-line interface tool locally:
# Build the project moon build --target native # Analyze a glTF or GLB file moon run cmd/main -- path/to/model.glb
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
首个基于纯 MoonBit 开发的 glTF 2.0 / GLB 3D 资产解析、格式校验与性能优化诊断工具箱。
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
moonbit-gltf-tools
A high-performance, lightweight glTF 2.0 and GLB asset parsing, validation, and optimization tool library written in pure MoonBit.
Features
Installation
Add this dependency to your
moon.mod:Quick Start
1. Parsing and Analyzing a Model
2. Unpacking a GLB File
CLI Usage
To run the command-line interface tool locally:
License
This project is licensed under the Apache License 2.0. See the LICENSE file for details.