Skip to main content

euv_core/game/fluid_kit/sph3d/
enum.rs

1use super::*;
2
3/// Dimensionality mode for `SphLiquidSolver3D` selecting 2D or 3D kernels and spatial hashing.
4#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub enum FluidDomainMode {
6    /// Planar 2D liquid simulation in the X-Y plane (`z = 0`) using normalized 2D SPH kernels.
7    Dim2,
8    /// Full volumetric 3D liquid simulation using normalized 3D SPH kernels.
9    #[default]
10    Dim3,
11}
12
13/// Composable solid boundary or obstacle geometry supported by `SphSolidCollider`.
14#[derive(Clone, Copy, Debug, PartialEq)]
15pub enum SphColliderShape {
16    /// Axis-aligned box acting as an enclosing vessel (`inward = true`) or solid obstacle (`inward = false`).
17    Box {
18        /// World-space box center.
19        center: Vec3,
20        /// Positive half-extents along `(X, Y, Z)`.
21        half_extents: Vec3,
22        /// `true` confines fluid inside the box; `false` pushes fluid outside the box.
23        inward: bool,
24    },
25    /// Spherical vessel (`inward = true`) or solid obstacle (`inward = false`).
26    Sphere {
27        /// World-space sphere center.
28        center: Vec3,
29        /// Sphere radius in meters.
30        radius: f32,
31        /// `true` confines fluid inside the sphere; `false` pushes fluid outside.
32        inward: bool,
33    },
34    /// Solid capsule obstacle defined by segment endpoints and radius.
35    Capsule {
36        /// First segment endpoint in world space.
37        point_a: Vec3,
38        /// Second segment endpoint in world space.
39        point_b: Vec3,
40        /// Capsule tube and hemispherical cap radius in meters.
41        radius: f32,
42    },
43    /// Vertical Y-axis cylinder acting as a tank (`inward = true`) or pillar (`inward = false`).
44    Cylinder {
45        /// World-space cylinder center.
46        center: Vec3,
47        /// Horizontal cross-section radius in meters.
48        radius: f32,
49        /// Half-height along world Y in meters.
50        half_height: f32,
51        /// `true` confines fluid inside the cylinder; `false` excludes fluid from its interior.
52        inward: bool,
53    },
54    /// Infinite half-space solid plane retaining particles on the `+normal` side.
55    Plane {
56        /// Reference point lying on the plane.
57        point: Vec3,
58        /// Outward unit normal pointing into the fluid region.
59        normal: Vec3,
60    },
61    /// Enclosed moving rectangular vessel imparting wall velocity and friction to contained fluid.
62    MovingContainer {
63        /// Current world-space box center.
64        center: Vec3,
65        /// Positive interior half-extents along `(X, Y, Z)`.
66        half_extents: Vec3,
67        /// Current linear wall velocity in meters per second.
68        linear_velocity: Vec3,
69    },
70}