https://github.com/openrr/mesh-loader
Fast parser for 3D-model-formats.
https://github.com/openrr/mesh-loader
collada dae obj rust stl
Last synced: 11 months ago
JSON representation
Fast parser for 3D-model-formats.
- Host: GitHub
- URL: https://github.com/openrr/mesh-loader
- Owner: openrr
- License: apache-2.0
- Created: 2022-02-14T02:02:57.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-27T06:44:44.000Z (about 1 year ago)
- Last Synced: 2025-04-08T05:36:40.402Z (12 months ago)
- Topics: collada, dae, obj, rust, stl
- Language: Rust
- Homepage:
- Size: 271 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mesh-loader
[](https://crates.io/crates/mesh-loader)
[](https://docs.rs/mesh-loader)
[](https://www.rust-lang.org)
[](https://github.com/openrr/mesh-loader/actions)
Fast parser for 3D-model-formats.
This currently supports the following three formats commonly used in robotics:
- [STL](https://en.wikipedia.org/wiki/STL_(file_format)) (.stl)
- [COLLADA](https://en.wikipedia.org/wiki/COLLADA) (.dae)
- [Wavefront OBJ](https://en.wikipedia.org/wiki/Wavefront_.obj_file) (.obj)
# Usage
[`Scene`] is filled with mesh data : name, vertices, normals, colors, texcoords and faces. But also its materials : opacity, shininess, index of refraction, texture, colors, ...
[`Loader`] implements `load` and `load_from_slice` which will guess the file media type. But also, `load_{stl/collada/obj}` and `load_{stl/collada/obj}_from_slice` for individual formats.
### Example
```
let path = std::path::Path::new("/your/path/to/file/file.{file_format}");
let loader = mesh_loader::Loader::default();
let scene = loader.load(path);
if let Ok(scene) = scene {
for mesh in &scene.meshes {
assert_eq!(mesh.name, "Your mesh name");
}
}
```