mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-21 20:08:15 +00:00
Preserve strict FBX geometry behavior
This commit is contained in:
Generated
+3
-3
@@ -842,9 +842,9 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-mesh"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=543098150ffc09914b662e61053d8cddf239bbe6#543098150ffc09914b662e61053d8cddf239bbe6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4a84c00372972fb99755cba34978a5e73387c3f0#4a84c00372972fb99755cba34978a5e73387c3f0"
|
||||
dependencies = [
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=543098150ffc09914b662e61053d8cddf239bbe6)",
|
||||
"craft-zip 0.1.0 (git+https://github.com/storytold/craft-libs?rev=4a84c00372972fb99755cba34978a5e73387c3f0)",
|
||||
"miniz_oxide 0.9.1",
|
||||
]
|
||||
|
||||
@@ -931,7 +931,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-zip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=543098150ffc09914b662e61053d8cddf239bbe6#543098150ffc09914b662e61053d8cddf239bbe6"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=4a84c00372972fb99755cba34978a5e73387c3f0#4a84c00372972fb99755cba34978a5e73387c3f0"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ rustix = { version = "1", default-features = false, features = ["std", "fs", "pr
|
||||
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "390fe98b0dd3fb84db7c3af7cbd958db4e8cc585" }
|
||||
craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "390fe98b0dd3fb84db7c3af7cbd958db4e8cc585", features = ["serde"] }
|
||||
craft-materialx = { git = "https://github.com/storytold/craft-libs", rev = "390fe98b0dd3fb84db7c3af7cbd958db4e8cc585" }
|
||||
craft-mesh = { git = "https://github.com/storytold/craft-libs", rev = "543098150ffc09914b662e61053d8cddf239bbe6", default-features = false, features = ["stl", "fbx"] }
|
||||
craft-mesh = { git = "https://github.com/storytold/craft-libs", rev = "4a84c00372972fb99755cba34978a5e73387c3f0", default-features = false, features = ["stl", "fbx"] }
|
||||
craft-mcmat = { git = "https://github.com/storytold/craft-libs", rev = "828b07f3c9f3f6a2e935087b859016a5e46b1c31" }
|
||||
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "828b07f3c9f3f6a2e935087b859016a5e46b1c31" }
|
||||
# Who draws the window frame, and the app-drawn strip as the title bar (crates/ui-egui/src/titlebar.rs).
|
||||
|
||||
@@ -8,6 +8,11 @@ fn limits() -> craft_mesh::Limits {
|
||||
craft_mesh::Limits {
|
||||
max_vertices: super::MAX_VERTICES,
|
||||
max_triangles: texturecraft_geom::MAX_TRIANGLES,
|
||||
max_face_corners: super::MAX_VERTICES,
|
||||
max_meshes: super::MAX_VERTICES,
|
||||
max_parts: super::MAX_VERTICES,
|
||||
max_materials: super::MAX_VERTICES,
|
||||
max_nodes: super::MAX_VERTICES,
|
||||
max_data_bytes: 1 << 31,
|
||||
max_extras: 100_000,
|
||||
..Default::default()
|
||||
@@ -52,7 +57,8 @@ pub(crate) fn package(file_name: &str, bytes: &[u8], found: &mut dyn FnMut(&str)
|
||||
if doc.version == 0 {
|
||||
return Err(malformed(KIND, "not an FBX file (no FBXHeaderExtension / FBXVersion)"));
|
||||
}
|
||||
doc.scene_with_options(&limits, &mut craft_mesh::no_external, &craft_mesh::fbx::SceneOptions { apply_inactive_rotation: true }).map_err(convert)?;
|
||||
doc.scene_with_options(&limits, &mut craft_mesh::no_external, &craft_mesh::fbx::SceneOptions { apply_inactive_rotation: true, strict_geometry: true })
|
||||
.map_err(convert)?;
|
||||
craft_mesh::fbx::package::write(&doc, file_name, bytes, &limits, package_limits(), found).map_err(convert)
|
||||
})
|
||||
}
|
||||
@@ -64,8 +70,9 @@ fn read_inner(bytes: &[u8], files: &mut Files) -> Result<RawMesh> {
|
||||
return Err(malformed(KIND, "not an FBX file (no FBXHeaderExtension / FBXVersion)"));
|
||||
}
|
||||
let colors = doc.diffuse_materials(&limits, files).map_err(convert)?;
|
||||
let scene =
|
||||
doc.scene_with_options(&limits, &mut craft_mesh::no_external, &craft_mesh::fbx::SceneOptions { apply_inactive_rotation: true }).map_err(convert)?;
|
||||
let scene = doc
|
||||
.scene_with_options(&limits, &mut craft_mesh::no_external, &craft_mesh::fbx::SceneOptions { apply_inactive_rotation: true, strict_geometry: true })
|
||||
.map_err(convert)?;
|
||||
let to_mat = |m: craft_mesh::Mat4| Mat4::from_cols_array(&m.map(|v| v as f32));
|
||||
let global = to_mat(doc.axes_to_y_up()) * Mat4::from_scale(Vec3::splat((doc.unit_scale().unwrap_or(1.0) / 100.0) as f32));
|
||||
let mut sink = PolygonSink::default();
|
||||
|
||||
Reference in New Issue
Block a user