Skip to main content

quantized_mesh/
lib.rs

1//! Encoder and decoder for Cesium quantized-mesh-1.0 terrain format.
2//!
3//! This crate provides encoding and decoding functionality for the quantized-mesh terrain format
4//! used by CesiumJS for efficient 3D terrain streaming.
5//!
6//! # References
7//!
8//! - Format specification: <https://github.com/CesiumGS/quantized-mesh>
9//!
10//! # Example
11//!
12//! ```
13//! use quantized_mesh::{
14//!     QuantizedMeshEncoder, QuantizedMeshHeader, QuantizedVertices,
15//!     EdgeIndices, TileBounds,
16//! };
17//!
18//! // Create header with tile metadata
19//! let header = QuantizedMeshHeader {
20//!     center: [0.0, 0.0, 6378137.0],
21//!     min_height: 0.0,
22//!     max_height: 100.0,
23//!     bounding_sphere_center: [0.0, 0.0, 6378137.0],
24//!     bounding_sphere_radius: 1000.0,
25//!     horizon_occlusion_point: [0.0, 0.0, 1.0],
26//! };
27//!
28//! // Create vertices (simple 2-triangle mesh)
29//! let vertices = QuantizedVertices {
30//!     u: vec![0, 32767, 0, 32767],
31//!     v: vec![0, 0, 32767, 32767],
32//!     height: vec![0, 0, 0, 0],
33//! };
34//!
35//! // Triangle indices (2 triangles)
36//! let indices = vec![0, 1, 2, 1, 3, 2];
37//!
38//! // Edge indices
39//! let edge_indices = EdgeIndices {
40//!     west: vec![0, 2],
41//!     south: vec![0, 1],
42//!     east: vec![1, 3],
43//!     north: vec![2, 3],
44//! };
45//!
46//! // Encode to quantized-mesh format
47//! let encoder = QuantizedMeshEncoder::new(header, vertices, indices, edge_indices);
48//! let data = encoder.encode();
49//! ```
50
51pub mod coords;
52mod decoding;
53mod encoding;
54mod header;
55mod types;
56
57pub use decoding::*;
58pub use encoding::*;
59pub use header::*;
60pub use types::*;