Skip to content

Commit

Permalink
add gltf generator
Browse files Browse the repository at this point in the history
  • Loading branch information
nokonoko1203 committed Nov 29, 2023
1 parent af4164b commit c392805
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nusamai-gltf/examples/geometry_to_gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ fn main() {
let _ = file.flush();

// glTF のモデルを作成
let mut gltf = GLTF::new();
let mut gltf = Gltf::new();

// glTF のアセットを作成
let mut asset = Asset::new();
Expand Down
2 changes: 1 addition & 1 deletion nusamai-gltf/examples/make_gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn main() -> io::Result<()> {
extras: None,
};

let mut gltf = GLTF {
let mut gltf = Gltf {
extensions_used: None,
extensions_required: None,
accessors: None,
Expand Down
5 changes: 5 additions & 0 deletions nusamai-gltf/src/generator.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use super::models::Gltf;

pub struct GltfGenerator {
pub gltf: Gltf,
}
2 changes: 2 additions & 0 deletions nusamai-gltf/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
mod generator;
mod models;

pub use generator::*;
pub use models::*;
4 changes: 2 additions & 2 deletions nusamai-gltf/src/models/gltf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use serde_json::Value;
#[derive(Serialize, Deserialize, Debug, Default)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct GLTF {
pub struct Gltf {
/// Names of glTF extensions used in this asset.
#[serde(skip_serializing_if = "Option::is_none")]
pub extensions_used: Option<Vec<String>>,
Expand Down Expand Up @@ -95,7 +95,7 @@ pub struct GLTFExtensions {
others: HashMap<String, Value>,
}

impl GLTF {
impl Gltf {
pub fn new() -> Self {
Default::default()
}

Check warning on line 101 in nusamai-gltf/src/models/gltf.rs

View check run for this annotation

Codecov / codecov/patch

nusamai-gltf/src/models/gltf.rs#L99-L101

Added lines #L99 - L101 were not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion nusamai-gltf/tests/test_load_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn load_examples() {
let path = path.unwrap();
println!("loading {:?}", path);
let src = std::fs::read_to_string(path).unwrap();
let a: GLTF = serde_json::from_str(&src).unwrap();
let a: Gltf = serde_json::from_str(&src).unwrap();
println!("{:?}", a);

// 'null' should not appear in output
Expand Down

0 comments on commit c392805

Please sign in to comment.