Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

raea-core-modelbox: a glTF model's triangles, box and seat facing, out of raea-sys-contact

shinyobjectz02a105058069
diff --git a/Cargo.lock b/Cargo.lock
index f47027f7..1d9b83ff 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -14378,6 +14378,15 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "raea-core-modelbox"
+version = "0.1.0"
+dependencies = [
+ "bevy",
+ "raea-core-scene",
+ "serde_json",
+]
+
[[package]]
name = "raea-core-place"
version = "0.1.0"
@@ -15859,6 +15868,7 @@ dependencies = [
"bevy",
"raea-core-facts",
"raea-core-meshcheck",
+ "raea-core-modelbox",
"raea-core-scene",
"raea-core-shape",
"raea-core-zfight",
diff --git a/Cargo.toml b/Cargo.toml
index 174452c4..349f3777 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,6 +7,7 @@ members = [
"core/ask",
"core/brief",
"core/zfight",
+ "core/modelbox",
"core/facts",
"core/ease",
"core/fonts",
diff --git a/core/modelbox/Cargo.toml b/core/modelbox/Cargo.toml
new file mode 100644
index 00000000..46a63140
--- /dev/null
+++ b/core/modelbox/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "raea-core-modelbox"
+version = "0.1.0"
+edition = "2024"
+license = "FSL-1.1-ALv2"
+publish = false
+description = "A glTF model's own geometry: its triangles read once, its box turned and scaled, and which way a seat faces"
+
+[dependencies]
+raea-core-scene = { path = "../../core/scene" }
+bevy = { version = "=0.20.0", default-features = false, features = ["std"] }
+serde_json = "1"
diff --git a/systems/contact/src/model.rs b/core/modelbox/src/lib.rs
similarity index 95%
rename from systems/contact/src/model.rs
rename to core/modelbox/src/lib.rs
index 88e5f7aa..406ec81a 100644
--- a/systems/contact/src/model.rs
+++ b/core/modelbox/src/lib.rs
@@ -1,4 +1,5 @@
//! A glTF model's own geometry for the scene.* native calls: its box turned and scaled, and which way a seat faces.
+//! raea-sys-contact reads its triangles from here, and its `forget` lets these go with its solids.
use std::collections::HashMap;
use std::sync::{Arc, Mutex, OnceLock};
@@ -11,13 +12,11 @@ use raea_core_scene::{gltf_tris, local};
/// Each glTF file's triangles, read once until [`forget`]
static CACHE: OnceLock<Mutex<HashMap<String, Result<Arc<Vec<Vec3>>, String>>>> = OnceLock::new();
-/// Lets go of every file's triangles and every part's solids this process made, which a long render's clipping check
-/// held to its end: on a 7-minute film, gigabytes still held while frame purity rendered its stills (SG4a).
+/// Lets go of every file's triangles this process read (raea-sys-contact's `forget` calls it with its solids).
pub fn forget() {
if let Some(c) = CACHE.get() {
c.lock().unwrap().clear();
}
- crate::solid::forget_solids();
}
/// A glTF file's triangles in its own space (its node transforms applied), read once until [`forget`].
diff --git a/systems/contact/Cargo.toml b/systems/contact/Cargo.toml
index 98e1bd4a..33869cd0 100644
--- a/systems/contact/Cargo.toml
+++ b/systems/contact/Cargo.toml
@@ -12,6 +12,8 @@ raea-core-scene = { path = "../../core/scene" }
raea-core-shape = { path = "../../core/shape" }
# the Blender step a model calls for (an unloadable format, triangles over budget for its distance): docs/blender.feature
raea-core-meshcheck = { path = "../../core/meshcheck" }
+# a glTF model's triangles, box and seat facing (scene.bounds, scene.facing)
+raea-core-modelbox = { path = "../../core/modelbox" }
# faces in one plane over each other (z-fighting), between parts and inside one model (MK8)
raea-core-zfight = { path = "../../core/zfight" }
# its results as Findings (docs/direction.feature DR3)
diff --git a/systems/contact/src/assets.rs b/systems/contact/src/assets.rs
index d32f899a..6226e039 100644
--- a/systems/contact/src/assets.rs
+++ b/systems/contact/src/assets.rs
@@ -7,7 +7,7 @@ use raea_core_meshcheck::blender;
use raea_core_scene::{Item, src_path};
use serde_json::{Value, json};
-use super::model::file_tris;
+use raea_core_modelbox::file_tris;
use super::seen::camera;
/// The frame's models measured against the camera: (findings, the error count).
diff --git a/systems/contact/src/lib.rs b/systems/contact/src/lib.rs
index cac2a365..d43c16c3 100644
--- a/systems/contact/src/lib.rs
+++ b/systems/contact/src/lib.rs
@@ -35,8 +35,14 @@ pub use found::{clip_findings, lint_findings};
mod clip;
pub use clip::Clipping;
-mod model;
-pub use model::{bounds, facing, forget, seat_facing};
+pub use raea_core_modelbox::{bounds, facing, seat_facing};
+
+/// Lets go of every file's triangles and every part's solids this process made, which a long render's clipping check
+/// held to its end: on a 7-minute film, gigabytes still held while frame purity rendered its stills (SG4a).
+pub fn forget() {
+ raea_core_modelbox::forget();
+ solid::forget_solids();
+}
mod solid;
use solid::*;
diff --git a/tools/layers.toml b/tools/layers.toml
index 91910690..41dbc6e7 100644
--- a/tools/layers.toml
+++ b/tools/layers.toml
@@ -13,6 +13,7 @@ raea-core-sdf = "core"
raea-core-grow = "core"
raea-core-review = "core"
raea-core-zfight = "core"
+raea-core-modelbox = "core"
raea-core-facts = "core"
raea-core-solidinfo = "core"
raea-core-place = "core"