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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// Copyright 2017 The gltf Library Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! glTF 2.0 loader
//!
//! This crate is intended to load [glTF 2.0], a file format designed for the
//! efficient runtime transmission of 3D scenes. The crate aims to provide
//! rustic utilities that make working with glTF simple and intuitive.
//!
//! [glTF 2.0]: https://www.khronos.org/gltf
//!
//! ## Installation
//!
//! Add `gltf` version 0.6 to your `Cargo.toml`.
//!
//! ```toml
//! [dependencies.gltf]
//! version = "0.6"
//! ```
//!
//! ## Examples
//!
//! ### Loading glTF from the file system
//!
//! The crate provides a `from_path` method whereby one can import glTF from the
//! system.
//!
//! ```
//! extern crate gltf;
//!
//! fn main() {
//! # #[allow(unused_variables)]
//! let path = "path/to/asset.gltf";
//! # let path = "./glTF-Sample-Models/2.0/Box/glTF/Box.gltf";
//! // This creates a `Future` that drives the loading
//! // of glTF and all of its data.
//! let import = gltf::Import::from_path(path);
//! // The simpliest way of working with futures is to
//! // block the thread until the glTF is ready.
//! match import.sync() {
//! Ok(gltf) => println!("{:#?}", gltf),
//! Err(err) => println!("error: {:?}", err),
//! }
//! }
//! ```
//!
//! An [`Import`] resolves to [`Gltf`], a data structure that provides helpful utilities
//! such as iterators for working with glTF.
//!
//! [`Import`]: import/struct.Import.html
//! [`Gltf`]: gltf/struct.Gltf.html
//!
//! ### Walking the node hierarchy
//!
//! Below demonstates visiting the root [`Node`]s of every [`Scene`], printing the
//! number of children each node has.
//!
//! [`Node`]: scene/struct.Node.html
//! [`Scene`]: scene/struct.Scene.html
//! ```
//! # fn run() -> Result<(), Box<std::error::Error>> {
//! # let path = "./glTF-Sample-Models/2.0/Box/glTF/Box.gltf";
//! let gltf = gltf::Import::from_path(path).sync()?;
//! for scene in gltf.scenes() {
//! for node in scene.nodes() {
//! // Do something with this node
//! println!(
//! "Node {} has {} children",
//! node.index(),
//! node.children().count(),
//! );
//! }
//! }
//! # Ok(())
//! # }
//! # fn main() {
//! # let _ = run().expect("No runtime errors");
//! # }
//! ```
extern crate base64;
extern crate futures;
extern crate gltf_derive;
extern crate image as image_crate;
extern crate serde;
extern crate serde_derive;
extern crate serde_json;
/// Contains `Accessor` and other related data structures.
/// Contains `Animation` and other related data structures.
/// Contains `Buffer`, `View`, and other related data structures.
/// Contains `Camera` and other related data structures.
/// Contains extension specific data structures.
/// Contains `Gltf`, and other related data structures.
/// Contains `Image` and other related data structures.
/// Contains functions for importing glTF 2.0 assets.
/// Contains (de)serializable data structures that match the glTF JSON text.
/// Contains `Material` and other related data structures.
/// Contains `Mesh` and other related data structures.
/// Contains `Root`.
/// Contains `Scene`, `Node`, and other related data structures.
/// Contains `Skin` and other related data structures.
/// Contains `Texture`, `Sampler`, and other related data structures.
/// Contains functions that validate glTF JSON data against the specification.
pub use Gltf;
pub use ;