1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! # occt-wasm
//!
//! `OpenCascade` CAD kernel via `WebAssembly` — no C++ toolchain required.
//!
//! This crate embeds a pre-built WASM binary of the [OpenCascade](https://github.com/Open-Cascade-SAS/OCCT)
//! B-Rep CAD kernel and runs it via [wasmtime](https://wasmtime.dev/). You get
//! full OCCT functionality (primitives, booleans, sweeps, tessellation, STEP I/O)
//! without installing any C++ compiler, `CMake`, or OCCT libraries.
//!
//! # Quick Start
//!
//! ```no_run
//! use occt_wasm::OcctKernel;
//!
//! let mut kernel = OcctKernel::new().unwrap();
//!
//! // Create shapes
//! let box_shape = kernel.make_box(10.0, 20.0, 30.0).unwrap();
//! let sphere = kernel.make_sphere(8.0).unwrap();
//!
//! // Boolean operations
//! let result = kernel.fuse(box_shape, sphere).unwrap();
//!
//! // Query
//! let volume = kernel.get_volume(result).unwrap();
//!
//! // Tessellate for rendering
//! let mesh = kernel.tessellate(result, 0.1, 0.5).unwrap();
//! println!("vertices: {}, triangles: {}",
//! mesh.positions.len() / 3,
//! mesh.indices.len() / 3);
//!
//! // STEP export
//! let step_data = kernel.export_step(result).unwrap();
//! ```
//!
//! # Architecture
//!
//! The WASM binary is brotli-compressed and embedded via `include_bytes!`.
//! On first call to [`OcctKernel::new()`], it is decompressed and compiled
//! by wasmtime. Shape data lives in an arena inside the WASM sandbox,
//! referenced by opaque [`ShapeHandle`] values.
// Generated code does cross-boundary integer casting (u32 <-> i32 for WASM ABI)
// and has parameter names from the C++ facade that trigger similar_names.
pub use ;
pub use OcctKernel;
pub use *;