tirbofish/dropbear · commit
160b23ff5cec41fd4777aee71023784eb0b3d625
wip: got asset working (sorta), everything else is broken
Signature present but could not be verified.
Unverified
@@ -12,12 +12,23 @@ use crate::model::Model; pub static ASSET_REGISTRY: LazyLock<Arc<RwLock<AssetRegistry>>> = LazyLock::new(|| Arc::new(RwLock::new(AssetRegistry::new()))); /// A handle with type [`T`] that provides an index to the [AssetRegistry] contents. -#[derive(Hash, Eq, PartialEq, Debug)] +#[derive(Hash, Eq, Debug)] pub struct Handle<T> { pub id: u64, _phantom: PhantomData<T> } +impl<T> PartialEq for Handle<T> { + fn eq(&self, other: &Self) -> bool { + if self.is_null() && other.is_null() { + return false; + } + self.id == other.id + } + + +} + impl<T> Copy for Handle<T> {} impl<T> Clone for Handle<T> { @@ -30,7 +41,7 @@ impl<T> Handle<T> { /// Creates a null handle, for when there is no way to uniquely identify a hash (such as a viewport texture). /// /// # Safety - /// You will want to watch out, as adding this onto the asset_old registry with a type + /// You will want to watch out, as adding this onto the asset registry with a type /// where there already is a null handle item, it will be overwritten and data /// will not be saved. It is the reason why you will want to consider using the [Self::is_null] /// function to verify if the storage of the type has gone through correctly. @@ -54,6 +65,14 @@ pub struct AssetRegistry { models: HashMap<u64, Model>, model_labels: HashMap<String, Handle<Model>>, } + +#[derive(Debug, Clone)] +#[dropbear_macro::repr_c_enum] +pub enum AssetKind { + Texture, + Model, +} +
Large diffs are not rendered by default. Showing the first 50 of 4707 lines. Show full diff