Skip to content

Commit

Permalink
Merge pull request #334 from Limit-Theory-Redux/dga/optimize-physics-…
Browse files Browse the repository at this point in the history
…collision-shapes

Introduce a cache for physics collision shapes.
  • Loading branch information
dgavedissian authored Nov 17, 2024
2 parents bcc5398 + 26ab982 commit 6d5dda0
Show file tree
Hide file tree
Showing 10 changed files with 284 additions and 212 deletions.
13 changes: 0 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion engine/lib/phx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ gilrs = "0.11"
glam = { version = "0.29", features = ["scalar-math"] }
glutin = "0.32"
glutin-winit = "0.5"
hashbrown = { version = "0.15", features = ["serde"] }
image = "0.25"
indexmap = "2.0"
kira = { version = "0.9", features = ["symphonia", "cpal", "serde"] }
Expand Down
6 changes: 3 additions & 3 deletions engine/lib/phx/script/ffi_gen/RigidBody.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function Loader.defineType()
RigidBody* RigidBody_CreateBoxFromMesh (Mesh* mesh);
RigidBody* RigidBody_CreateSphere ();
RigidBody* RigidBody_CreateSphereFromMesh (Mesh* mesh);
RigidBody* RigidBody_CreateConvexHullFromMesh (Mesh const* mesh);
RigidBody* RigidBody_CreateConvexDecompositionFromMesh (Mesh const* mesh);
RigidBody* RigidBody_CreateTrimeshFromMesh (Mesh const* mesh);
RigidBody* RigidBody_CreateConvexHullFromMesh (Mesh* mesh);
RigidBody* RigidBody_CreateConvexDecompositionFromMesh (Mesh* mesh);
RigidBody* RigidBody_CreateTrimeshFromMesh (Mesh* mesh);
RigidBody* RigidBody_GetParentBody (RigidBody const*);
void RigidBody_ApplyForce (RigidBody*, Vec3f const* force);
void RigidBody_ApplyTorque (RigidBody*, Vec3f const* torque);
Expand Down
167 changes: 0 additions & 167 deletions engine/lib/phx/src/physics/collision_shape.rs

This file was deleted.

10 changes: 10 additions & 0 deletions engine/lib/phx/src/physics/collision_shape_type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use crate::math::Vec3;
use crate::render::Mesh;

pub enum CollisionShapeType {
Box { half_extents: Vec3 },
Sphere { radius: f32 },
ConvexHull { mesh: Mesh },
ConvexDecomposition { mesh: Mesh },
Trimesh { mesh: Mesh },
}
6 changes: 4 additions & 2 deletions engine/lib/phx/src/physics/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
mod collision_shape;
mod collision_shape_type;
mod physics;
mod rigid_body;
mod shape_cache;
mod trigger;
mod wrappers;

pub use collision_shape::*;
pub use collision_shape_type::*;
pub use physics::*;
pub use rigid_body::*;
pub use shape_cache::*;
pub use trigger::*;
pub use wrappers::*;
Loading

0 comments on commit 6d5dda0

Please sign in to comment.