kitgit

tirbofish/dropbear · diff

7b40ac3 · Thribhu K

feature: implemented my destroy() (scene exit function), and laid some groundwork for physics updates. also added some new docs and new native signatures + magna-carta updates. jarvis, run github actions

Unverified

diff --git a/Cargo.toml b/Cargo.toml
index f99ffd6..9e97293 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -79,6 +79,7 @@ quote = "1.0"
 egui_ltreeview = { version = "0.6", features = ["doc"] }
 dyn-hash = "1.0"
 semver = { version = "1.0", features = ["serde"] }
+rapier3d = { version = "0.31", features = [ "simd-stable" ] }
 
 [workspace.dependencies.image]
 version = "0.25"
diff --git a/dropbear-engine/src/lib.rs b/dropbear-engine/src/lib.rs
index e31a9d3..7dcaff2 100644
--- a/dropbear-engine/src/lib.rs
+++ b/dropbear-engine/src/lib.rs
@@ -17,6 +17,8 @@ pub mod shader;
 pub mod utils;
 
 pub static WGPU_BACKEND: OnceLock<String> = OnceLock::new();
+pub const PHYSICS_STEP_RATE: u32 = 50;
+const MAX_PHYSICS_STEPS_PER_FRAME: usize = 8;
 
 use app_dirs2::{AppDataType, AppInfo};
 use bytemuck::Contiguous;
@@ -76,12 +78,16 @@ pub struct State {
     pub texture_id: Arc<TextureId>,
     pub future_queue: Arc<FutureQueue>,
 
+    physics_accumulator: Duration,
+
     pub scene_manager: scene::Manager,
 }
 
 impl State {
     /// Asynchronously initialised the state and sets up the backend and surface for wgpu to render to.
     pub async fn new(window: Arc<Window>, instance: Arc<Instance>, future_queue: Arc<FutureQueue>) -> anyhow::Result<Self> {
+        let title = window.title();
+
         let size = window.inner_size();
 
         let surface = instance.create_surface(window.clone())?;
@@ -96,7 +102,7 @@ impl State {
 
         let (device, queue) = adapter
             .request_device(&wgpu::DeviceDescriptor {
-                label: None,
+                label: Some(format!("{} graphics device", title).as_str()),
                 required_features: wgpu::Features::empty(),
                 required_limits: wgpu::Limits::default(),

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