kitgit

tirbofish/dropbear · diff

c8aafb9 · Thribhu K

wip: overhaul on assets, with uuid linking planned.

Unverified

diff --git a/Cargo.toml b/Cargo.toml
index afea4c0..e863633 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -89,6 +89,7 @@ float-derive = "0.1"
 rkyv = "0.8"
 bevy_mikktspace = "1.0.0"
 naga = { version = "29", features = ["wgsl-in"] }
+uuid = { version = "1.22", features = ["v4", "serde"] }
 
 [workspace.dependencies.image]
 version = "0.25"
diff --git a/crates/dropbear-engine/src/procedural/mod.rs b/crates/dropbear-engine/src/procedural/mod.rs
index fe5d54c..0549ced 100644
--- a/crates/dropbear-engine/src/procedural/mod.rs
+++ b/crates/dropbear-engine/src/procedural/mod.rs
@@ -108,9 +108,7 @@ impl ProcedurallyGeneratedObject {
         let model = Model {
             label: label.clone(),
             hash,
-            path: ResourceReference::from_reference(crate::utils::ResourceReferenceType::ProcObj(
-                self.clone(),
-            )),
+            path: ResourceReference::Procedural(self.clone()),
             meshes: vec![mesh],
             materials: vec![material],
             skins: Vec::new(),
diff --git a/crates/dropbear-engine/src/utils.rs b/crates/dropbear-engine/src/utils.rs
index a66f4bf..f621c67 100644
--- a/crates/dropbear-engine/src/utils.rs
+++ b/crates/dropbear-engine/src/utils.rs
@@ -77,171 +77,136 @@ pub fn relative_path_from_euca(uri: &str) -> anyhow::Result<&str> {
     Ok(stripped.strip_prefix("resources/").unwrap_or(stripped))
 }
 
-/// An enum that contains the different types that a resource reference can possibly be.
+/// A reference to an asset used to identify and load it.
 ///
-/// # Example
-/// ```rust
-/// use dropbear_engine::utils::{ResourceReferenceType, ResourceReference};
+/// `File` holds a path relative to the project's `resources/` directory
+/// (e.g. `"models/cube.glb"`).  `Embedded` carries raw bytes.
+/// `Procedural` stores the procedurally generated geometry directly.
 ///
-/// let resource_ref = ResourceReference::from_reference(
-///     ResourceReferenceType::File("euca://models/cube.obj".to_string())
-/// );
-/// assert_eq!(resource_ref.as_path().unwrap(), "models/cube.obj");
-/// ```

Large diffs are not rendered by default. Showing the first 50 of 1964 lines. Show full diff