Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream' into update-testbed-bevy_0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz committed Sep 9, 2024
2 parents 8ec386d + 1b57c18 commit c04e6a9
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 37 deletions.
10 changes: 0 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
members = ["build/salva2d", "build/salva3d", "examples2d", "examples3d"]
resolver = "2"

[workspace.lints]
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim2", "dim3", "nphysics", "ncollide"))',
] }

[profile.release]
#lto = true
#codegen-units = 1
Expand Down Expand Up @@ -41,8 +36,3 @@ rapier_testbed3d = { git = "https://github.com/dimforge/rapier" }
# rapier3d = { path = "../rapier/crates/rapier3d" }
# rapier_testbed2d = { path = "../rapier/crates/rapier_testbed2d" }
# rapier_testbed3d = { path = "../rapier/crates/rapier_testbed3d" }

#nphysics2d = { path = "../nphysics/build/nphysics2d" }
#nphysics3d = { path = "../nphysics/build/nphysics3d" }
#ncollide2d = { path = "../ncollide/build/ncollide2d" }
#ncollide3d = { path = "../ncollide/build/ncollide3d" }
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
</p>
<p align = "center">
<strong>
<a href="https://salva.rs">Users guide</a> | <a href="https://docs.rs/salva2d/latest/salva2d">2D Documentation</a> | <a href="https://docs.rs/salva3d/latest/salva3d">3D Documentation</a> | <a href="https://discourse.nphysics.org">Forum</a>
<a href="https://salva.rs">Users guide</a> | <a href="https://docs.rs/salva2d/latest/salva2d">2D Documentation</a> | <a href="https://docs.rs/salva3d/latest/salva3d">3D Documentation</a> | <a href="https://discord.gg/vt9DJSW">Discord</a>
</strong>
</p>

-----

**Salva** is a 2 and 3-dimensional particle-based fluid simulation engine for games and animations.
It uses [nalgebra](https://nalgebra.org) for vector/matrix math and can optionally interface with
[nphysics](https://nphysics.org) for two-way coupling with rigid bodies, multibodies, and deformable bodies.
[rapier](https://rapier.rs) for two-way coupling with rigid bodies, multibodies, and deformable bodies.
2D and 3D implementations both share (mostly) the same code!


Examples are available in the `examples2d` and `examples3d` directories. Because those demos are based on
WASM and WebGl 1.0 they should work on most modern browsers. Feel free to ask for help
and discuss features on the official [user forum](https://discourse.nphysics.org).
and discuss features on the official [discord](https://discord.gg/vt9DJSW).

## Why the name Salva?

Expand All @@ -44,5 +44,5 @@ is inspired from its renown painting [The Persistence of Memory](https://en.wiki
- **Surface tension:** WCSPH surface tension, and methods from He et al. 2014 and Akinci et al. 2013
- **Elasticity:** method from Becker et al. 2009
- **Multiphase fluids**: mix several fluids with different characteristics (densities, viscosities, etc.)
- Optional **two-way coupling** with bodies from **nphysics**.
- Optional **two-way coupling** with bodies from **rapier**.
- **WASM** support
4 changes: 3 additions & 1 deletion build/salva2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ license = "Apache-2.0"
edition = "2021"

[lints]
workspace = true
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim3"))',
] }

[badges]
maintenance = { status = "actively-developed" }
Expand Down
8 changes: 5 additions & 3 deletions build/salva3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ keywords = ["physics", "dynamics", "particles", "fluids", "SPH"]
license = "Apache-2.0"
edition = "2021"

[lints]
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim2"))',
] }

[features]
default = ["dim3"]
dim3 = []
Expand All @@ -23,9 +28,6 @@ parry = ["parry3d"]
wasm-bindgen = ["rapier3d/wasm-bindgen"]
graphics = ["bevy", "bevy_egui"]

[lints]
workspace = true

[lib]
name = "salva3d"
path = "../../src/lib.rs"
Expand Down
4 changes: 2 additions & 2 deletions examples2d/all_examples2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn demo_name_from_command_line() -> Option<String> {
None
}

#[cfg(any(target_arch = "wasm32"))]
#[cfg(target_arch = "wasm32")]
fn demo_name_from_url() -> Option<String> {
let window = stdweb::web::window();
let hash = window.location()?.search().ok()?;
Expand All @@ -34,7 +34,7 @@ fn demo_name_from_url() -> Option<String> {
}
}

#[cfg(not(any(target_arch = "wasm32")))]
#[cfg(not(target_arch = "wasm32"))]
fn demo_name_from_url() -> Option<String> {
None
}
Expand Down
4 changes: 2 additions & 2 deletions examples3d/all_examples3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn demo_name_from_command_line() -> Option<String> {
None
}

#[cfg(any(target_arch = "wasm32"))]
#[cfg(target_arch = "wasm32")]
fn demo_name_from_url() -> Option<String> {
None
// let window = stdweb::web::window();
Expand All @@ -39,7 +39,7 @@ fn demo_name_from_url() -> Option<String> {
// }
}

#[cfg(not(any(target_arch = "wasm32")))]
#[cfg(not(target_arch = "wasm32"))]
fn demo_name_from_url() -> Option<String> {
None
}
Expand Down
4 changes: 2 additions & 2 deletions src/counters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod solver_counters;
mod stages_counters;
mod timer;

/// Aggregation of all the performances counters tracked by nphysics.
/// Aggregation of all the performances counters tracked by salva.
#[derive(Clone, Copy)]
pub struct Counters {
/// Total number of substeps performed.
Expand All @@ -30,7 +30,7 @@ pub struct Counters {
}

impl Counters {
/// Create a new set of counters initialized to wero.
/// Create a new set of counters initialized to zero.
pub fn new() -> Self {
Counters {
nsubsteps: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/coupling/coupling_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::object::{BoundarySet, Fluid};
use crate::TimestepManager;

/// Trait that needs to be implemented by middlewares responsible for
/// coupling bodies from a rigid-body physic framework (nphysics, bullet, PhysX, etc.)
/// coupling bodies from a rigid-body physic framework (rapier, bullet, PhysX, etc.)
/// with boundary objects of salva.
pub trait CouplingManager {
/// Updates the boundary objects from the coupled bodies.
Expand Down
10 changes: 3 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*!
**Salva** is a 2 and 3-dimensional particle-based fluid simulation engine for games and animations.
It uses [nalgebra](https://nalgebra.org) for vector/matrix math and can optionally interface with
[nphysics](https://nphysics.org) for two-way coupling with rigid bodies, multibodies, and deformable bodies.
[rapier](https://rapier.rs) for two-way coupling with rigid bodies, multibodies, and deformable bodies.
2D and 3D implementations both share (mostly) the same code!
Examples are available in the `examples2d` and `examples3d` directories. Because those demos are based on
WASM and WebGl 1.0 they should work on most modern browsers. Feel free to ask for help
and discuss features on the official [user forum](https://discourse.nphysics.org).
and discuss features on the official [discord](https://discord.gg/vt9DJSW).
## Why the name Salva?
Expand All @@ -20,7 +20,7 @@ The name of this library is inspired from the famous surrealist artist `Salvador
- **Surface tension:** WCSPH surface tension, and methods from He et al. 2014 and Akinci et al. 2013
- **Elasticity:** method from Becker et al. 2009
- **Multiphase fluids**: mix several fluids with different characteristics (densities, viscosities, etc.)
- Optional **two-way coupling** with bodies from **nphysics**.
- Optional **two-way coupling** with bodies from **rapier**.
- **WASM** support
*/
#![deny(non_camel_case_types)]
Expand All @@ -36,10 +36,6 @@ The name of this library is inspired from the famous surrealist artist `Salvador
#![doc(html_logo_url = "https://salva.rs/img/logo_salva_rustdoc.svg")]

extern crate nalgebra as na;
#[cfg(all(feature = "dim2", feature = "ncollide"))]
extern crate ncollide2d as ncollide;
#[cfg(all(feature = "dim3", feature = "ncollide"))]
extern crate ncollide3d as ncollide;
extern crate num_traits as num;
#[cfg(all(feature = "dim2", feature = "parry"))]
pub extern crate parry2d as parry;
Expand Down
8 changes: 4 additions & 4 deletions src/object/fluid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ impl Fluid {
}

/// Computes the AABB of this fluid.
#[cfg(feature = "nphysics")]
pub fn compute_aabb(&self, particle_radius: Real) -> ncollide::bounding_volume::AABB<Real> {
use ncollide::bounding_volume::{self, BoundingVolume};
bounding_volume::local_point_cloud_aabb(&self.positions).loosened(particle_radius)
#[cfg(feature = "parry")]
pub fn compute_aabb(&self, particle_radius: Real) -> parry::bounding_volume::Aabb {
use parry::bounding_volume::{details::local_point_cloud_aabb, BoundingVolume};
local_point_cloud_aabb(&self.positions).loosened(particle_radius)
}

/// The mass of the `i`-th particle of this fluid.
Expand Down
2 changes: 1 addition & 1 deletion src/sampling/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Methods for converting shapes from ncollide to sets of points.
//! Methods for converting shapes from parry to sets of points.

pub use self::ray_sampling::{
shape_surface_ray_sample, shape_volume_ray_sample, surface_ray_sample, volume_ray_sample,
Expand Down

0 comments on commit c04e6a9

Please sign in to comment.