diff --git a/Cargo.toml b/Cargo.toml index f706263..8b47468 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,8 +19,8 @@ edition = "2021" [workspace.dependencies] clap = { version = "4.5.1", features = ["derive"] } -gltf = { version = "=1.3.0", default-features = false, features = [ "import", "names", "utils" ] } -gltf-json = { version = "=1.3.0", features = [ "names" ] } +gltf = { version = "=1.4.0", default-features = false, features = [ "import", "names", "utils" ] } +gltf-json = { version = "=1.4.0", features = [ "names" ] } grim = { path = "core/grim" } itertools = "0.12.1" lazy_static = "1.4.0" diff --git a/core/grim/src/model/export.rs b/core/grim/src/model/export.rs index 30167bc..8593df5 100644 --- a/core/grim/src/model/export.rs +++ b/core/grim/src/model/export.rs @@ -1065,7 +1065,7 @@ impl GltfExporter { json::Buffer { name: None, - byte_length: total_size as u32, + byte_length: total_size.into(), uri: Some(str_data), extensions: None, extras: Default::default() @@ -1075,9 +1075,9 @@ impl GltfExporter { gltf.buffer_views = vec![ json::buffer::View { name: Some(String::from("verts_norms")), - byte_length: bv_verts_norms as u32, - byte_offset: Some(0), - byte_stride: Some(12), + byte_length: bv_verts_norms.into(), + byte_offset: Some(0u64.into()), + byte_stride: Some(json::buffer::Stride(12)), buffer: json::Index::new(0), target: None, extensions: None, @@ -1085,9 +1085,9 @@ impl GltfExporter { }, json::buffer::View { name: Some(String::from("uvs")), - byte_length: bv_uvs as u32, - byte_offset: Some(bv_verts_norms as u32), - byte_stride: Some(8), + byte_length: bv_uvs.into(), + byte_offset: Some(bv_verts_norms.into()), + byte_stride: Some(json::buffer::Stride(8)), buffer: json::Index::new(0), target: None, extensions: None, @@ -1095,9 +1095,9 @@ impl GltfExporter { }, json::buffer::View { name: Some(String::from("weights_tans")), - byte_length: bv_weights_tans as u32, - byte_offset: Some((bv_verts_norms + bv_uvs) as u32), - byte_stride: Some(16), + byte_length: bv_weights_tans.into(), + byte_offset: Some((bv_verts_norms + bv_uvs).into()), + byte_stride: Some(json::buffer::Stride(16)), buffer: json::Index::new(0), target: None, extensions: None, @@ -1105,8 +1105,8 @@ impl GltfExporter { }, json::buffer::View { name: Some(String::from("faces")), - byte_length: bv_faces as u32, - byte_offset: Some((bv_verts_norms + bv_uvs + bv_weights_tans) as u32), + byte_length: bv_faces.into(), + byte_offset: Some((bv_verts_norms + bv_uvs + bv_weights_tans).into()), byte_stride: None, buffer: json::Index::new(0), target: None, diff --git a/core/grim_gltf/src/lib.rs b/core/grim_gltf/src/lib.rs index 6fc3b42..2ba4971 100644 --- a/core/grim_gltf/src/lib.rs +++ b/core/grim_gltf/src/lib.rs @@ -1,7 +1,7 @@ use gltf_json as json; use itertools::*; use serde::ser::Serialize; -use std::collections::{HashMap}; +use std::collections::HashMap; pub struct AccessorBuilder { // Key = stride, Value = (idx, data) @@ -93,8 +93,8 @@ impl AccessorBuilder { // Create accessor let accessor = json::Accessor { buffer_view: Some(json::Index::new(buff_idx as u32)), - byte_offset: Some(buff_off as u32), - count: count as u32, + byte_offset: Some(buff_off.into()), + count: count.into(), component_type: json::validation::Checked::Valid(json::accessor::GenericComponentType(comp_type)), extensions: None, extras: Default::default(), @@ -139,11 +139,11 @@ impl AccessorBuilder { views.push(json::buffer::View { name: None, - byte_length: data_size as u32, - byte_offset: Some(data_offset as u32), + byte_length: data_size.into(), + byte_offset: Some(data_offset.into()), byte_stride: match stride { 64 => None, // Hacky way to disable writing stride for inverse bind transforms - s if s % 4 == 0 => Some(stride as u32), + s if s % 4 == 0 => Some(json::buffer::Stride(stride)), _ => None // Don't encode if not multiple }, buffer: json::Index::new(0), @@ -163,7 +163,7 @@ impl AccessorBuilder { // Create buffer json let buffer = json::Buffer { name: None, - byte_length: buffer_data.len() as u32, + byte_length: buffer_data.len().into(), uri: match name.into() { s if !s.is_empty() => Some(s), _ => None