Physics#

namespace physics#

Typedefs

using RigidBodyId = std::uint32_t#

Unique numeric identifier for a rigid body.

using ColliderId = std::uint32_t#

Unique numeric identifier for a physical collider.

using BallJointId = std::uint32_t#

Unique numeric identifier for an articulated ball joint.

using SphericalJointId = std::uint32_t#

Unique numeric identifier for an articulated spherical joint.

using HingeJointId = std::uint32_t#

Unique numeric identifier for an articulated hinge joint.

using SliderJointId = std::uint32_t#

Unique numeric identifier for an articulated slider (prismatic) joint.

using RigidDistanceConstraintId = std::uint32_t#

Unique numeric identifier for a rigid-to-rigid distance constraint.

using ParticleConstraintId = std::uint32_t#

Unique numeric identifier for an inter-particle distance constraint.

using RigidParticleAttachmentConstraintId = std::uint32_t#

Unique numeric identifier for a rigid-body to particle attachment constraint.

using StrandRigidAttachmentConstraintId = std::uint32_t#

Unique numeric identifier for a strand-to-rigid attachment constraint.

using RoutedCableConstraintId = std::uint32_t#

Unique numeric identifier for a routed cable constraint.

using ParticleCollisionFilterId = std::uint32_t#

Unique numeric identifier for an authored particle collision filter.

using ParticleSequenceId = std::uint32_t#

Unique numeric identifier for an authored particle sequence.

using SuturingSequenceId = std::uint32_t#

Unique numeric identifier for an authored suturing sequence.

using SoftEdge = DeformableDistanceConstraint#

Alias for deformable distance edge constraint.

using SoftTet = DeformableVolumeConstraint#

Alias for tetrahedral volume constraint.

using SoftBend = DeformableBendConstraint#

Alias for deformable bending constraint.

Enums

enum class ColliderShapeType : std::uint32_t#

Geometric primitive shapes supported for rigid-body collision detection.

Values:

enumerator Sphere#

Spherical collider defined by radius (shapeParams.x).

enumerator Box#

Box collider defined by half-extents (shapeParams.xyz).

enumerator Capsule#

Capsule collider defined by radius (shapeParams.x) and half-height (shapeParams.y).

enum class RigidBodyType : std::uint32_t#

Simulation behavior types for rigid bodies.

Values:

enumerator Static#

Immobile obstacle with infinite mass and zero velocity.

enumerator Kinematic#

User-driven or keyframed body unaffected by external forces.

enumerator Dynamic#

Fully simulated body responding to gravity, forces, and collisions.

enum class RigidJointDriveMode : std::uint32_t#

Actuator drive control modes for articulated rigid joints.

Values:

enumerator None#

Joint drive disabled (passive joint).

enumerator TargetPosition#

Drive targets a desired joint position or angle.

enumerator TargetVelocity#

Drive targets a desired angular or linear velocity.

enumerator TargetOrientation#

Drive targets a desired 3D orientation quaternion (spherical joints).

enum class SoftBodySourceKind : std::uint32_t#

Generation methods and mesh representations for deformable soft bodies.

Values:

enumerator RegularGrid#

Procedural voxel regular grid.

enumerator TetMesh#

Explicit tetrahedral mesh vertex array and index buffer.

enumerator TetGenFiles#

TetGen .node and .ele file paths.

enumerator MeshfreeParticles#

Meshfree particle point cloud with k-nearest neighbors.

enum class FluidSourceKind : std::uint32_t#

Initialization source types for fluid simulations.

Values:

enumerator RegularGrid#

Grid-aligned particle emitter block.

enum class ParticleKind : std::uint32_t#

Fundamental particle physics classification.

Values:

enumerator SoftSolid#

Deformable soft solid, strand, or rigid proxy particle.

enumerator Fluid#

Incompressible SPH / Position-Based Fluid particle.

enum class ParticleOwnerType : std::uint32_t#

Owner classification for unified simulation particles.

Values:

enumerator None#

Unallocated particle slot.

enumerator SoftBody#

Particle owned by a 3D deformable SoftBody.

enumerator FluidBody#

Particle owned by a FluidBody.

enumerator Strand#

Particle owned by a 1D elastic Strand.

enumerator RigidBody#

Proxy particle attached to a RigidBody.

enum class AuthoredParticleReferenceType : std::uint32_t#

Target owner classification when referencing particles in authored constraints.

Values:

enumerator SoftBodyParticle#

Reference indexes into a soft body’s particle array.

enumerator StrandParticle#

Reference indexes into a strand’s particle array.

enumerator RigidProxyParticle#

Reference indexes into a rigid body’s proxy particle array.

enum class ParticleStrandRole : std::uint32_t#

Role of a particle in surgical needle and suturing thread sequences.

Values:

enumerator None#

Normal strand particle.

enumerator NeedleTip#

Surgical needle piercing tip node.

enumerator NeedleBody#

Rigid curved surgical needle body node.

enumerator Thread#

Flexible suture thread trailing node.

enum class SuturingInsertionState : std::uint32_t#

State tracking whether a needle tip or particle is inside a soft-tissue volume.

Values:

enumerator Outside#

Particle is in free space outside the soft tissue.

enumerator Inside#

Particle has penetrated into the soft tissue volume.

enum class PhysicsRebuildFlags : std::uint32_t#

Bitmask flags indicating internal data structures that need rebuilding after authoring updates.

Values:

enumerator None#

No rebuild required.

enumerator SoftParticleLayout#

Particle memory layout changed.

enumerator SoftConstraintData#

Edge, tetrahedral, or bending constraints changed.

enumerator SuturingData#

Needle suturing pairing metadata changed.

enumerator ResolvedRigidParticleAttachments#

Rigid-particle attachments need re-resolution.

enumerator ResolvedStrandRigidAttachments#

Strand-rigid attachments need re-resolution.

enumerator ResolvedRigidDistanceConstraints#

Rigid-to-rigid distance constraints need re-resolution.

enumerator ResolvedRoutedCables#

Routed cable paths need re-resolution.

Functions

bool readParticleCloudBin(const std::filesystem::path &path, std::vector<Diligent::float3> &particles, std::string &errorMessage)#

Reads 3D particle coordinates from a binary file on disk.

The file must contain either raw little-endian float triplets or a little-endian uint32 count followed by that many float triplets.

Parameters:
  • path – File system path to the particle cloud binary file.

  • particles – Output vector populated with 3D particle positions on success.

  • errorMessage – Output error message description populated on failure.

Returns:

True if particle cloud was read successfully, false otherwise.

std::vector<Diligent::float3> loadParticleCloud(const std::filesystem::path &path)#

Loads 3D particle coordinates from disk.

Parameters:

path – File system path to the particle cloud binary file.

Returns:

Loaded positions, or an empty vector after logging a read/format failure.

bool readObjSurfaceMesh(const std::filesystem::path &path, SurfaceMeshData &mesh, std::string &errorMessage)#

Reads an OBJ format triangle surface mesh from disk.

Parameters:
  • path – File system path to the .obj file.

  • mesh – Output SurfaceMeshData structure populated on success.

  • errorMessage – Output error message description populated on failure.

Returns:

True if file was read and parsed successfully, false otherwise.

SurfaceMeshData loadObjSurfaceMesh(const std::filesystem::path &path)#

Loads an OBJ format triangle surface mesh from disk.

Parameters:

path – File system path to the .obj file.

Returns:

Loaded mesh, or an empty mesh after logging a read/parse failure.

constexpr std::uint32_t packParticlePhase(std::uint32_t groupId, bool selfCollisionEnabled) noexcept#

Packs a particle phase group ID and a self-collision boolean into a single 32-bit integer.

Parameters:
  • groupId – Unique phase group identifier (lower 31 bits).

  • selfCollisionEnabled – Whether particles in this group can collide with each other.

Returns:

Packed 32-bit particle phase bitfield.

constexpr std::uint32_t particlePhaseGroup(std::uint32_t phase) noexcept#

Extracts the phase group ID from a packed particle phase bitfield.

Parameters:

phase – Packed 32-bit particle phase value.

Returns:

Unmasked phase group identifier.

constexpr bool particlePhaseSelfCollideEnabled(std::uint32_t phase) noexcept#

Checks whether self-collision is enabled in a packed particle phase bitfield.

Parameters:

phase – Packed 32-bit particle phase value.

Returns:

True if the self-collision flag bit is set.

Variables

constexpr std::uint32_t kParticlePhaseGroupMask = 0x7fffffffu#

Bitmask isolating the 31-bit particle collision phase group ID.

constexpr std::uint32_t kParticlePhaseSelfCollideFlag = 0x80000000u#

Bit flag indicating whether intra-group particle self-collision is enabled.

constexpr RigidBodyId kInvalidRigidBodyId = 0u#

Sentinel constant representing an invalid or unallocated RigidBodyId.

constexpr ColliderId kInvalidColliderId = 0u#

Sentinel constant representing an invalid or unallocated ColliderId.

constexpr BallJointId kInvalidBallJointId = 0u#

Sentinel constant representing an invalid or unallocated BallJointId.

constexpr SphericalJointId kInvalidSphericalJointId = 0u#

Sentinel constant representing an invalid or unallocated SphericalJointId.

constexpr HingeJointId kInvalidHingeJointId = 0u#

Sentinel constant representing an invalid or unallocated HingeJointId.

constexpr SliderJointId kInvalidSliderJointId = 0u#

Sentinel constant representing an invalid or unallocated SliderJointId.

constexpr RigidDistanceConstraintId kInvalidRigidDistanceConstraintId = 0u#

Sentinel constant representing an invalid or unallocated RigidDistanceConstraintId.

constexpr ParticleConstraintId kInvalidParticleConstraintId = 0u#

Sentinel constant representing an invalid or unallocated ParticleConstraintId.

constexpr RigidParticleAttachmentConstraintId kInvalidRigidParticleAttachmentConstraintId = 0u#

Sentinel constant representing an invalid or unallocated RigidParticleAttachmentConstraintId.

constexpr StrandRigidAttachmentConstraintId kInvalidStrandRigidAttachmentConstraintId = 0u#

Sentinel constant representing an invalid or unallocated StrandRigidAttachmentConstraintId.

constexpr RoutedCableConstraintId kInvalidRoutedCableConstraintId = 0u#

Sentinel constant representing an invalid or unallocated RoutedCableConstraintId.

constexpr ParticleCollisionFilterId kInvalidParticleCollisionFilterId = 0u#

Sentinel constant representing an invalid or unallocated ParticleCollisionFilterId.

constexpr ParticleSequenceId kInvalidParticleSequenceId = 0u#

Sentinel constant representing an invalid or unallocated ParticleSequenceId.

constexpr SuturingSequenceId kInvalidSuturingSequenceId = 0u#

Sentinel constant representing an invalid or unallocated SuturingSequenceId.

constexpr std::uint32_t kInvalidSuturingIndex = 0xffffffffu#

Sentinel index indicating an uninitialized or invalid suturing index.

struct AuthoredParticleCollisionFilterState#
#include <physics_types.h>

Collision filtering override for an individual particle.

Public Members

ParticleCollisionFilterId filterId = kInvalidParticleCollisionFilterId#

Unique filter ID.

AuthoredParticleReference particle = {}#

Target particle reference.

std::uint32_t collisionLayer = 1u#

Collision layer bitmask.

std::uint32_t collisionMask = 0xffffffffu#

Collision filter bitmask.

bool enabled = true#

Whether collision filtering is active.

struct AuthoredParticleDistanceConstraintState#
#include <physics_types.h>

Authored distance constraint between two referenced particles.

Public Members

ParticleConstraintId constraintId = kInvalidParticleConstraintId#

Unique constraint ID.

AuthoredParticleReference particleA = {}#

First referenced particle.

AuthoredParticleReference particleB = {}#

Second referenced particle.

float restLength = 0.0f#

Target rest distance separation.

float compliance = 0.0f#

XPBD constraint compliance.

bool enabled = true#

Whether constraint is active.

struct AuthoredParticleReference#
#include <physics_types.h>

Reference locating a specific simulation particle within an authored entity.

Public Members

common::EntityId entityId = common::kInvalidEntityId#

Target entity ID.

AuthoredParticleReferenceType type#

Entity particle owner type.

std::uint32_t localParticleIndex = 0u#

Zero-based local index of the particle.

struct AuthoredParticleSequenceState#
#include <physics_types.h>

Ordered sequence of particle references.

Public Members

ParticleSequenceId sequenceId = kInvalidParticleSequenceId#

Unique sequence ID.

std::vector<AuthoredParticleReference> entries = {}#

Ordered list of particle references.

bool enabled = true#

Whether sequence is active.

struct AuthoredRigidDistanceConstraintState#
#include <physics_types.h>

Authored distance constraint between anchor points on two rigid bodies.

Public Members

RigidDistanceConstraintId constraintId#

Unique constraint ID.

common::EntityId entityA = common::kInvalidEntityId#

First rigid-body entity ID.

common::EntityId entityB = common::kInvalidEntityId#

Second rigid-body entity ID.

Diligent::float3 localAnchorA = {0.0f, 0.0f, 0.0f}#

Anchor position in body A local space.

Diligent::float3 localAnchorB = {0.0f, 0.0f, 0.0f}#

Anchor position in body B local space.

float restDistance = 0.0f#

Target rest distance between anchors.

float compliance = 0.0f#

XPBD constraint compliance.

bool enabled = true#

Whether constraint is active.

struct AuthoredRigidParticleAttachmentConstraintState#
#include <physics_types.h>

Authored attachment constraint between a referenced particle and a rigid body.

Public Members

RigidParticleAttachmentConstraintId constraintId#

Unique constraint ID.

AuthoredParticleReference particle = {}#

Target particle reference.

common::EntityId rigidBodyEntityId = common::kInvalidEntityId#

Target rigid-body entity ID.

Diligent::float3 localAnchor#

Attachment anchor in rigid-body local space.

float compliance = 0.0f#

XPBD constraint compliance.

bool enabled = true#

Whether attachment is active.

struct AuthoredRoutedCableConstraintState#
#include <physics_types.h>

Cable length constraint routed through an ordered sequence of rigid-body guide points.

Public Members

RoutedCableConstraintId constraintId#

Unique constraint ID.

std::vector<AuthoredRoutedCableRoutePoint> routePoints = {}#

Ordered guide points along the cable path.

float targetLength = 0.0f#

Target total cable length.

float compliance = 0.0f#

XPBD constraint compliance.

bool tensionOnly = true#

True if constraint resists stretching only (slack allowed).

bool enabled = true#

Whether constraint is active.

struct AuthoredRoutedCableRoutePoint#
#include <physics_types.h>

Guide point on a rigid body through which a routed cable passes.

Public Functions

inline constexpr bool operator==(const AuthoredRoutedCableRoutePoint &rhs) const noexcept#

Public Members

common::EntityId entityId#

Rigid-body entity ID hosting the guide.

Diligent::float3 localGuideOffset#

Local coordinate offset of guide on the body.

struct AuthoredStrandRigidAttachmentConstraintState#
#include <physics_types.h>

One-way attachment constraint where a rigid body kinematic/dynamic pose drives a strand segment.

Public Members

StrandRigidAttachmentConstraintId constraintId#

Unique constraint ID.

This constraint is intentionally one-way: the rigid body drives the strand station pose, but the strand does not push force or torque back into the rigid body.

common::EntityId strandEntityId = common::kInvalidEntityId#

Strand entity ID.

std::uint32_t localSegmentIndex = 0u#

Attached segment index along the strand.

float segmentT = 0.0f#

Parametric position [0, 1] along segment.

common::EntityId rigidBodyEntityId#

Driving rigid-body entity ID.

Diligent::float3 localAnchor = {0.0f, 0.0f, 0.0f}#

Local anchor offset in rigid body.

Diligent::QuaternionF localRotation#

Relative orientation in rigid body.

float translationCompliance = 0.0f#

Positional compliance.

float rotationCompliance = 0.0f#

Angular rotational compliance.

bool enabled = true#

Whether attachment is active.

struct AuthoredSuturingSequenceState#
#include <physics_types.h>

Authored surgical needle and suture thread sequence for soft-tissue puncture tracking.

Public Members

SuturingSequenceId sequenceId = kInvalidSuturingSequenceId#

Unique suturing sequence ID.

std::vector<AuthoredParticleReference> entries = {}#

Ordered needle and thread particle references.

std::uint32_t tipEntryIndex = 0u#

The selected tip entry authors the suturing path. In the current prototype, the sequence tip and tail also suppress same-soft-body exterior contact.

float pathNodeSpacing = 0.0f#

Desired spacing between generated path interpolation nodes.

bool enabled = true#

Whether suturing tracking is active.

struct BallJointSoAHost#
#include <physics_types.h>

Structure-of-Arrays (SoA) host memory container holding ball joint descriptors.

Public Functions

inline std::size_t size() const noexcept#
inline bool empty() const noexcept#
inline void clear()#

Public Members

std::vector<std::uint32_t> bodyIndicesA#
std::vector<std::uint32_t> bodyIndicesB#
std::vector<std::uint32_t> enabledFlags#
std::vector<Diligent::float4> localAnchorsA#
std::vector<Diligent::float4> localAnchorsB#
struct BallJointState#
#include <physics_types.h>

State descriptor for an articulated ball (spherical point-to-point) joint.

Public Members

BallJointId jointId = kInvalidBallJointId#

Unique joint identifier.

bool enabled = true#

Active state flag.

bool suppressConnectedBodyCollisions#

Whether collision between connected bodies is suppressed.

RigidBodyId bodyA = kInvalidRigidBodyId#

First connected rigid body ID.

RigidBodyId bodyB = kInvalidRigidBodyId#

Second connected rigid body ID.

Diligent::float3 localAnchorA = {0.0f, 0.0f, 0.0f}#

Anchor position in body A local space.

Diligent::float3 localAnchorB = {0.0f, 0.0f, 0.0f}#

Anchor position in body B local space.

struct BodyColliderMappingHost#
#include <physics_types.h>

Host mapping table relating rigid bodies to their attached collider indices.

Public Functions

inline void clear()#

Public Members

std::vector<std::uint32_t> colliderOffsets#
std::vector<std::uint32_t> colliderCounts#
std::vector<std::uint32_t> colliderIndices#
struct ColliderSoAGpu#
#include <physics_types.h>

GPU metadata descriptor for collider SoA buffers.

Public Members

std::uint32_t colliderCount = 0#
std::uint32_t capacity = 0#
struct ColliderSoAHost#
#include <physics_types.h>

Structure-of-Arrays (SoA) host memory container holding collider descriptors.

Public Functions

inline std::size_t size() const noexcept#
inline bool empty() const noexcept#
inline void clear()#

Public Members

std::vector<ColliderId> colliderIds#
std::vector<common::EntityId> entityIds#
std::vector<RigidBodyId> ownerRigidBodyIds#
std::vector<std::uint32_t> ownerRigidBodyIndices#
std::vector<std::uint32_t> shapeTypes#
std::vector<Diligent::float4> shapeParams#
std::vector<Diligent::float4> localPositions#
std::vector<Diligent::float4> localOrientations#
std::vector<std::uint32_t> enabledFlags#
std::vector<Diligent::float4> frictionRestitution#
std::vector<std::uint32_t> environmentIndices#
std::vector<std::uint32_t> collisionLayers#
std::vector<std::uint32_t> collisionMasks#
struct ColliderState#
#include <physics_types.h>

Physical collision shape attachment for rigid bodies.

Public Members

ColliderId colliderId = kInvalidColliderId#

Unique collider identifier.

common::EntityId entityId = common::kInvalidEntityId#

Associated ECS entity ID.

RigidBodyId ownerRigidBodyId = kInvalidRigidBodyId#

Owning rigid body identifier.

ColliderShapeType shapeType#

Geometric shape type (Sphere, Box, Capsule).

Diligent::float4 shapeParams#

Shape geometric dimensions (radius, half-extents).

Diligent::float3 localPosition#

Local translation offset from rigid body center.

Diligent::QuaternionF localRotation = {0.0f, 0.0f, 0.0f, 1.0f}#

Local rotation offset.

bool enabled = true#

Active collision state.

float friction = 0.5f#

Dynamic kinetic friction coefficient.

float staticFriction = -1.0f#

Static friction coefficient (-1 reuses friction).

float restitution = 0.0f#

Restitution coefficient (bounciness).

std::uint32_t collisionLayer = 1u#

Bitmask collision layer.

std::uint32_t collisionMask = 0xffffffffu#

Bitmask collision filter mask.

struct ContactSolverSettings#
#include <physics_solver.h>

Numerical stabilization parameters for contact and collision resolution.

Occupies 32 bytes to match its GPU uniform counterpart layout.

Public Members

float slop = 1.0e-3f#

Contact penetration allowance slop.

float manifoldMergeSlopMultiplier#

Multiplier for clustering contact manifold points.

float softRelaxation = 0.95f#

Relaxation coefficient for soft particle contact.

float softMaxCorrectionPerIteration#

Maximum position correction clamp per iteration for soft contact.

float restitutionVelocityThreshold#

Minimum relative impact velocity required to trigger restitution.

float restitutionPenetrationSlopMultiplier#

Slop multiplier above which restitution is suppressed.

float rigidRestitutionVelocityThreshold#

Minimum velocity threshold for rigid-body restitution.

float positionFrictionMinDistance#

Minimum separation distance threshold for applying positional friction.

struct CurveRenderDataHost#
#include <physics_types.h>

Host container for curve rendering descriptors.

Public Functions

inline void clear()#

Public Members

std::vector<CurveRenderDescriptorHost> descriptors#
std::vector<std::uint32_t> particleIndices#
struct CurveRenderDescriptorHost#
#include <physics_types.h>

Curve rendering descriptor for strand tubular geometry generation.

Public Members

std::uint32_t particleIndexStart = 0u#
std::uint32_t particleCount = 0u#
std::uint32_t vertexBase = 0u#
std::uint32_t vertexCount = 0u#
std::uint32_t radialResolution = 0u#
std::uint32_t environmentIndex = 0u#
float radius = 0.0f#
struct DeformableBendConstraint#
#include <physics_types.h>

Bending angle constraint among a triplet of deformable particles.

Public Members

std::uint32_t particle0 = 0u#

Index of first particle.

std::uint32_t particle1 = 0u#

Index of vertex hinge particle.

std::uint32_t particle2 = 0u#

Index of third particle.

float restAngle = 0.0f#

Target rest bending angle in radians.

float compliance = 0.0f#

XPBD bending compliance.

std::uint32_t reserved0 = 0u#

Reserved padding.

std::uint32_t reserved1 = 0u#

Reserved padding.

std::uint32_t reserved2 = 0u#

Reserved padding.

struct DeformableDistanceConstraint#
#include <physics_types.h>

XPBD distance constraint between two deformable particles.

Public Members

std::uint32_t particleA = 0u#

Index of first particle.

std::uint32_t particleB = 0u#

Index of second particle.

float restLength = 0.0f#

Target rest distance.

float compliance = 0.0f#

XPBD constraint compliance.

std::uint32_t enabled = 1u#

Keep authored constraints resident in the GPU edge buffer so enable/disable can be evaluated by the solver instead of changing the constraint’s GPU identity.

std::uint32_t reserved0 = 0u#

Reserved padding.

std::uint32_t reserved1 = 0u#

Reserved padding.

std::uint32_t reserved2 = 0u#

Reserved padding.

struct DeformableVolumeConstraint#
#include <physics_types.h>

Hydrostatic volume conservation constraint for tetrahedral elements.

Public Members

Diligent::uint4 particleIndices#

4 particle indices forming the tetrahedron.

float restVolume = 0.0f#

Target rest volume.

float compliance = 0.0f#

Hydrostatic volume compliance.

std::uint32_t reserved0 = 0u#

Reserved padding.

std::uint32_t reserved1 = 0u#

Reserved padding.

struct FluidMaterialDesc#
#include <physics_types.h>

Physical and fluid-dynamic material parameters for Position-Based Fluids.

Public Members

ParticleContactMaterialDesc contact = {}#

Contact interaction properties against solids.

float viscosity = 0.01f#

Dynamic kinematic viscosity coefficient.

float cohesion = 0.0f#

Inter-particle cohesion attraction force coefficient.

float surfaceTension = 0.0f#

Surface tension energy coefficient.

float vorticityConfinement#

Vorticity confinement force multiplier to preserve turbulent eddies.

float gravityScale = 1.0f#

Multiplier for gravitational acceleration on fluid.

float cflCoefficient = 1.0f#

CFL stability condition time-step factor.

struct FluidMaterialGpu#
#include <physics_types.h>

GPU representation of fluid material properties and derived numerical constants.

Occupies 48 bytes matching its GPU uniform layout.

Public Functions

inline constexpr bool operator==(const FluidMaterialGpu &rhs) const noexcept#

Public Members

float restDensity#

PBF solver rest-density reference; PhysicsWorld derives it from spacing.

float invRestDensity = 1.0f / 1000.0f#

Reciprocal PBF solver rest-density reference.

float smoothingRadius = 0.4f#

SPH kernel smoothing radius (h).

float densityConstraintScaleDerived#

Precomputed density constraint normalization scale.

float viscosityDerived = 0.01f / 1000.0f#

Derived kinematic viscosity.

float cohesionDerived = 0.0f#

Derived cohesion factor.

float cohesion1 = 0.0f#

Derived cohesion term 1.

float cohesion2 = 0.0f#

Derived cohesion term 2.

float surfaceTensionDerived = 0.0f#

Derived surface tension factor.

float vorticityConfinementDerived = 0.0f#

Derived vorticity confinement factor.

float gravityScale = 1.0f#

Gravity scaling factor.

float cflRadius = 0.25f#

Radius for CFL velocity limit.

struct FluidRegularGridSource#
#include <physics_types.h>

Source parameters for generating a regular grid fluid volume.

Public Members

Diligent::float3 size#

3D bounding box extents for fluid particle placement.

float targetParticleSpacing = 0.25f#

Desired inter-particle spacing distance.

struct FluidSolverSettings#
#include <physics_solver.h>

Numerical relaxation and boundary scaling parameters for Position-Based Fluids (PBF).

Occupies 32 bytes to match its GPU uniform counterpart layout.

Public Members

float constraintRelaxation = 0.7f#

Relaxation factor for density constraint solving.

float positionRelaxation = 1.0f#

Position relaxation factor applied after fluid advection.

float boundaryDensityScale = 0.12f#

Boundary density coupling scale against solid bodies.

float boundaryDeltaScale = 0.08f#

Boundary position delta scale.

float maxUnderDensityRatio#

Threshold below rest density for allowing negative pressure.

float reserved1 = 0.0f#

Reserved padding.

float reserved2 = 0.0f#

Reserved padding.

float reserved3 = 0.0f#

Reserved padding.

struct FluidSourceDesc#
#include <physics_types.h>

Discriminated union descriptor selecting the source configuration for fluid particles.

Public Members

FluidSourceKind kind = FluidSourceKind::RegularGrid#

Selected fluid source kind.

FluidRegularGridSource regularGrid#

Regular grid parameters.

struct FluidState#
#include <physics_types.h>

State descriptor for an authored particle-based fluid body.

Public Members

common::EntityId entityId = common::kInvalidEntityId#

Associated ECS entity ID.

std::uint32_t environmentIndex = 0u#

Multi-environment index.

std::uint32_t collisionLayer = 1u#

Collision layer bitmask.

std::uint32_t collisionMask = 0xffffffffu#

Collision filter bitmask.

FluidSourceDesc source = {}#

Source emitter/generator configuration.

FluidMaterialDesc material = {}#

Fluid material parameters (viscosity, cohesion).

Diligent::float4 visualColor#

RGBA color for rendering fluid particles.

common::Transform restTransform = {}#

World transform placement of fluid block.

float particleMass = 1.0f#

Mass per fluid particle.

float particleRadius = 0.125f#

SPH interaction radius.

std::uint32_t contactMaterialIndex = 0u#

Contact material table index.

std::uint32_t fluidMaterialIndex = 0u#

Fluid material table index.

std::uint32_t particleOffset = 0u#

Offset in global particle buffer.

std::uint32_t particleCount = 0u#

Number of fluid particles.

std::vector<Diligent::float3> restPositions#

Rest positions of fluid particles.

struct GpuSuturingInsertionState#
#include <physics_types.h>

GPU tracking structure representing needle penetration state and barycentric coordinate mapping.

Public Members

std::uint32_t state#

Current SuturingInsertionState.

std::uint32_t softBodyIndex = kInvalidSuturingIndex#

Index of penetrated soft body.

std::uint32_t tetIndex = kInvalidSuturingIndex#

Index of containing tetrahedron.

std::uint32_t pathIndex = kInvalidSuturingIndex#

Index of active suturing path.

std::uint32_t nearestNodeIndex = kInvalidSuturingIndex#

Nearest generated path node index.

std::uint32_t closestSegmentTBits = 0u#

Encoded parametric t along segment.

std::uint32_t reserved1 = 0u#

Reserved padding.

std::uint32_t reserved2 = 0u#

Reserved padding.

Diligent::float4 barycentrics#

Barycentric coordinates inside tetrahedron.

struct HingeJointSoAHost#
#include <physics_types.h>

Structure-of-Arrays (SoA) host memory container holding hinge joint descriptors.

Public Functions

inline std::size_t size() const noexcept#
inline bool empty() const noexcept#
inline void clear()#

Public Members

std::vector<std::uint32_t> bodyIndicesA#
std::vector<std::uint32_t> bodyIndicesB#
std::vector<std::uint32_t> enabledFlags#
std::vector<std::uint32_t> driveModes#
std::vector<Diligent::float4> localAnchorsA#
std::vector<Diligent::float4> localAnchorsB#
std::vector<Diligent::float4> localAxesA0#
std::vector<Diligent::float4> localAxesA1#
std::vector<Diligent::float4> localAxesB1#
std::vector<std::uint32_t> limitEnabledFlags#
std::vector<float> limitMins#
std::vector<float> limitMaxs#
std::vector<float> constraintCompliances#
std::vector<float> driveCompliances#
std::vector<float> driveTargetAngles#
std::vector<float> driveDampings#
std::vector<float> driveMaxAngularVelocities#
std::vector<float> driveTargetAngularVelocities#
std::vector<Diligent::float4> projectionRow0#
std::vector<Diligent::float4> projectionRow1#
std::vector<Diligent::float4> projectionRow2#
struct HingeJointState#
#include <physics_types.h>

State descriptor for an articulated 1-DOF revolute hinge joint with limits and actuator drive.

Public Members

HingeJointId jointId = kInvalidHingeJointId#

Unique joint identifier.

bool enabled = true#

Active state flag.

bool suppressConnectedBodyCollisions = false#

Suppress collision between connected bodies.

RigidJointDriveMode driveMode = RigidJointDriveMode::None#

Actuator drive control mode.

bool limitEnabled = false#

Whether angular limits are enabled.

RigidBodyId bodyA = kInvalidRigidBodyId#

First connected body ID.

RigidBodyId bodyB = kInvalidRigidBodyId#

Second connected body ID.

Diligent::float3 localAnchorA = {0.0f, 0.0f, 0.0f}#

Anchor in body A local space.

Diligent::float3 localAnchorB = {0.0f, 0.0f, 0.0f}#

Anchor in body B local space.

Diligent::QuaternionF localRotationA = {0.0f, 0.0f, 0.0f, 1.0f}#

Joint orientation in body A.

Diligent::QuaternionF localRotationB = {0.0f, 0.0f, 0.0f, 1.0f}#

Joint orientation in body B.

float limitMin = 0.0f#

Minimum hinge angle limit (radians).

float limitMax = 0.0f#

Maximum hinge angle limit (radians).

float constraintCompliance = 0.0f#

Hinge constraint compliance.

float driveCompliance = 0.0f#

Actuator drive compliance.

float driveTargetAngle = 0.0f#

Target angle for position drive (radians).

float driveDamping = 0.0f#

Damping coefficient for hinge drive.

float driveMaxAngularVelocity = 0.0f#

Maximum velocity clamp for drive.

float driveTargetAngularVelocity = 0.0f#

Target angular velocity for velocity drive.

struct JointCollisionSuppressionHost#
#include <physics_types.h>

Host container for collision suppression pairs between connected joint bodies.

Public Functions

inline void clear()#

Public Members

std::vector<std::uint32_t> neighborOffsets#
std::vector<std::uint32_t> neighbors#
struct JointSolverSettings#
#include <physics_solver.h>

Numerical stabilization and relaxation parameters for articulated rigid joints.

Occupies 32 bytes to match its GPU uniform counterpart layout.

Public Members

float ballRelaxation = 0.95f#

Relaxation factor for ball joints.

float articulatedRelaxation#

Relaxation factor for hinge, slider, and spherical joints.

float maxError = 0.05f#

Maximum allowable joint position error before clamping.

float maxTranslationCorrection#

Maximum linear translation correction applied per iteration.

float maxAngularCorrection = 0.12f#

Maximum angular correction applied per iteration.

float regularization = 1.0e-5f#

Regularization epsilon for joint constraint matrices.

float angularRegularization#

Regularization epsilon for angular constraint matrices.

float minXpbdDt = 1.0e-5f#

Minimum delta-time floor used in XPBD compliance computation.

struct ParticleContactMaterialDesc#
#include <physics_types.h>

Contact and frictional material properties for particle interactions.

Public Members

float friction = 0.0f#

Dynamic kinetic friction coefficient.

float restitution = 0.0f#

Coefficient of restitution (bounciness).

float damping = 0.0f#

Contact velocity damping factor.

float staticFriction = -1.0f#

Static friction coefficient (<0 reuses dynamic friction).

struct ParticleSoAHost#
#include <physics_types.h>

Structure-of-Arrays (SoA) host memory container holding unified particle attributes.

Public Functions

inline std::size_t size() const noexcept#
inline bool empty() const noexcept#
inline void clear()#

Public Members

std::vector<Diligent::float4> positionsInvMass#
std::vector<Diligent::float4> previousPositions#
std::vector<Diligent::float4> velocities#
std::vector<float> radii#
std::vector<std::uint32_t> environmentIndices#
std::vector<std::uint32_t> particleKinds#
std::vector<std::uint32_t> ownerTypes#
std::vector<std::uint32_t> ownerIndices#
std::vector<std::uint32_t> strandIds#
std::vector<std::uint32_t> strandOrders#
std::vector<std::uint32_t> strandRoles#
std::vector<Diligent::uint4> suturingNeighborLinks#
std::vector<std::uint32_t> suturingParticleIndices#
std::vector<std::uint32_t> owningSoftBodyIndices#
std::vector<std::uint32_t> particleMaterialIndices#
std::vector<std::uint32_t> fluidMaterialIndices#
std::vector<std::uint32_t> phases#
std::vector<std::uint32_t> collisionLayers#
std::vector<std::uint32_t> collisionMasks#
std::vector<std::uint32_t> adjacencyOffsets#
std::vector<std::uint32_t> adjacencyCounts#
std::vector<std::uint32_t> adjacencyIndices#
std::vector<Diligent::float4> rigidProxyLocalPositions#
struct PhysicsGpuBuffers#
#include <physics_types.h>

Aggregate GPU and host buffer container for physics scene state.

Public Members

RigidBodySoAHost rigidBodies = {}#
ColliderSoAHost colliders = {}#
RigidBodySoAGpu rigidBodyGpu = {}#
ColliderSoAGpu colliderGpu = {}#
struct PhysicsGpuCurveSceneView#
#include <physics_gpu_scene_view.h>

GPU buffer bindings for strand curve rendering and extrusion geometry.

Public Members

Diligent::IBuffer *descriptorsBuffer#

GPU buffer of CurveRenderDescriptorHost descriptors.

Diligent::IBuffer *particleIndicesBuffer#

GPU buffer of particle indices forming each curve.

Diligent::IBuffer *positionsBuffer#

GPU buffer of generated curve vertex positions.

Diligent::IBuffer *normalsBuffer#

GPU buffer of generated curve vertex normal vectors.

Diligent::IBuffer *worldAabbsBuffer = nullptr#

GPU buffer of world-space AABBs for curves.

std::uint32_t curveCount = 0#

Number of curve render descriptors.

std::uint64_t bindingGeneration = 0#

Revision counter for curve scene buffer allocations.

struct PhysicsGpuJointSceneView#
#include <physics_gpu_scene_view.h>

GPU buffer bindings and counts for articulated rigid joints.

Public Members

Diligent::IBuffer *ballJointsBuffer = nullptr#

GPU buffer of BallJointState descriptors.

Diligent::IBuffer *sphericalJointsBuffer#

GPU buffer of SphericalJointState descriptors.

Diligent::IBuffer *hingeJointsBuffer = nullptr#

GPU buffer of HingeJointState descriptors.

Diligent::IBuffer *hingeJointRuntimeStatesBuffer#

GPU buffer of dynamic runtime hinge joint state.

Diligent::IBuffer *sliderJointsBuffer#

GPU buffer of SliderJointState descriptors.

Diligent::IBuffer *sliderJointRuntimeStatesBuffer#

GPU buffer of dynamic runtime slider joint state.

std::uint32_t ballJointCount = 0u#

Number of active ball joints.

std::uint32_t hingeJointCount = 0u#

Number of active hinge joints.

std::uint32_t sphericalJointCount = 0u#

Number of active spherical joints.

std::uint32_t sliderJointCount = 0u#

Number of active slider joints.

std::uint64_t bindingGeneration = 0u#

Revision counter for joint buffer allocations.

struct PhysicsGpuParticleBufferView#
#include <physics_gpu_scene_view.h>

GPU buffer bindings for unified particle systems (soft bodies, strands, fluids, and proxy particles).

Public Members

Diligent::IBuffer *positionsInvMassBuffer#

GPU buffer of float4 particle positions (xyz) and inverse mass (w).

Diligent::IBuffer *previousPositionsBuffer#

GPU buffer of particle positions from previous substep.

Diligent::IBuffer *velocitiesBuffer#

GPU buffer of float4 particle velocity vectors.

Diligent::IBuffer *radiiBuffer = nullptr#

GPU buffer of particle collision radii.

Diligent::IBuffer *environmentIndicesBuffer#

GPU buffer of environment assignments.

Diligent::IBuffer *particleKindsBuffer = nullptr#

GPU buffer of ParticleKind values.

Diligent::IBuffer *ownerTypesBuffer = nullptr#

GPU buffer of ParticleOwnerType values.

Diligent::IBuffer *ownerIndicesBuffer#

GPU buffer of owning body/strand/fluid index.

Diligent::IBuffer *strandIdsBuffer#

GPU buffer of strand IDs for strand particles.

Diligent::IBuffer *strandRolesBuffer#

GPU buffer of ParticleStrandRole suturing values.

Diligent::IBuffer *suturingNeighborLinksBuffer#

GPU buffer of suturing neighbor topological links.

Diligent::IBuffer *owningSoftBodyIndicesBuffer#

GPU buffer mapping particles to owning soft-body index.

Diligent::IBuffer *particleMaterialIndicesBuffer#

GPU buffer of contact material indices.

Diligent::IBuffer *fluidMaterialIndicesBuffer#

GPU buffer of fluid material indices.

Diligent::IBuffer *fluidVisualsBuffer#

GPU buffer of fluid particle render colors.

Diligent::IBuffer *particleContactMaterialsBuffer#

GPU buffer of contact material parameters.

Diligent::IBuffer *fluidMaterialsBuffer#

GPU buffer of FluidMaterialGpu parameters.

Diligent::IBuffer *phasesBuffer#

GPU buffer of packed particle collision phase bitfields.

Diligent::IBuffer *collisionLayersBuffer = nullptr#

GPU buffer of collision layer bitmasks.

Diligent::IBuffer *collisionMasksBuffer = nullptr#

GPU buffer of collision filter bitmasks.

Diligent::IBuffer *adjacencyOffsetsBuffer#

GPU buffer of neighbor adjacency list start offsets.

Diligent::IBuffer *adjacencyCountsBuffer#

GPU buffer of neighbor adjacency counts.

Diligent::IBuffer *adjacencyIndicesBuffer#

GPU buffer of flattened neighbor particle indices.

Diligent::IBuffer *fluidSurfaceNormalConstraintsBuffer#

GPU buffer of fluid surface normal constraints.

Diligent::IBuffer *fluidAnisotropy1Buffer#

GPU buffer of fluid surface anisotropy tensor column 1.

Diligent::IBuffer *fluidAnisotropy2Buffer#

GPU buffer of fluid surface anisotropy tensor column 2.

Diligent::IBuffer *fluidAnisotropy3Buffer#

GPU buffer of fluid surface anisotropy tensor column 3.

std::uint32_t count = 0#

Total number of particles in the buffer.

std::uint32_t fluidVisualCount = 0#

Number of fluid particles rendered.

std::uint32_t contactMaterialCount = 0#

Number of contact material entries.

std::uint32_t fluidMaterialCount = 0#

Number of fluid material entries.

struct PhysicsGpuRigidSceneView#
#include <physics_gpu_scene_view.h>

GPU buffer bindings and counts representing rigid bodies, colliders, and attachments.

Public Members

common::PoseBufferView poses = {}#

Instanced pose buffer view for render transforms.

Diligent::IBuffer *statePositionsBuffer#

GPU buffer of rigid-body center-of-mass positions and inverse masses.

Diligent::IBuffer *stateOrientationsBuffer#

GPU buffer of rigid-body orientation quaternions.

Diligent::IBuffer *stateLinearVelocitiesBuffer#

GPU buffer of rigid-body linear velocity vectors.

Diligent::IBuffer *stateAngularVelocitiesBuffer#

GPU buffer of rigid-body angular velocity vectors.

Diligent::IBuffer *inverseInertiaLocalBuffer#

GPU buffer of body-local diagonal inverse inertia tensors.

Diligent::IBuffer *bodyTypesBuffer = nullptr#

GPU buffer of RigidBodyType values.

Diligent::IBuffer *proxyParticleContactMaterialsBuffer#

GPU buffer of proxy contact material parameters.

Diligent::IBuffer *kinematicTargetPositionsBuffer#

GPU buffer of kinematic target positions.

Diligent::IBuffer *kinematicTargetOrientationsBuffer#

GPU buffer of kinematic target orientations.

Diligent::IBuffer *kinematicTargetFlagsBuffer#

GPU buffer of kinematic drive target active flags.

Diligent::IBuffer *colliderOwnerBodyIndicesBuffer#

GPU buffer mapping colliders to owning rigid-body indices.

Diligent::IBuffer *colliderBroadPhaseBuffer#

GPU buffer of collider axis-aligned bounding boxes (AABBs).

Diligent::IBuffer *colliderGeometryBuffer#

GPU buffer of collider geometric dimensions (radius, half-extents).

Diligent::IBuffer *colliderMaterialsBuffer#

GPU buffer of collider friction and restitution parameters.

Diligent::IBuffer *colliderShapeTypesBuffer#

GPU buffer of ColliderShapeType values.

Diligent::IBuffer *colliderEnabledFlagsBuffer#

GPU buffer of collider enabled bitflags.

Diligent::IBuffer *bodyColliderOffsetsBuffer#

GPU buffer of start offsets into the collider index list per body.

Diligent::IBuffer *bodyColliderCountsBuffer#

GPU buffer of collider counts per rigid body.

Diligent::IBuffer *bodyColliderRangesBuffer#

GPU buffer of collider contiguous ranges.

Diligent::IBuffer *bodyColliderIndicesBuffer#

GPU buffer of flattened collider indices.

Diligent::IBuffer *rigidParticleAttachmentsBuffer#

GPU buffer of RigidParticleAttachmentConstraint descriptors.

Constraint item buffers preserve prepare()/uploadWorld()-resolved slot ownership but allow runtime mutation of supported per-slot fields through custom compute. For rigid-particle attachments this includes the live descriptor payload read directly by the solver (particleIndex, rigidBodyIndex, compliance, enabled) as long as the caller does not assume prepared host-side layout mappings will reflect those GPU-only edits.

Diligent::IBuffer *strandRigidAttachmentsBuffer#

GPU buffer of StrandRigidAttachmentConstraint descriptors.

Diligent::IBuffer *rigidDistanceConstraintsBuffer#

GPU buffer of RigidDistanceConstraint descriptors.

Diligent::IBuffer *routedCableDescriptorsBuffer#

GPU buffer of RoutedCableConstraint descriptors.

Diligent::IBuffer *routedCableRoutePointsBuffer#

GPU buffer of RoutedCableRoutePoint descriptors.

Diligent::IBuffer *routedCableDebugSegmentsBuffer#

GPU buffer for routed cable debug line visualizer segments.

std::uint32_t bodyCount = 0#

Total active rigid bodies in the scene.

std::uint32_t rigidParticleAttachmentCount#

Number of rigid-particle attachment constraints.

std::uint32_t strandRigidAttachmentCount#

Number of strand-rigid attachment constraints.

std::uint32_t rigidDistanceConstraintCount#

Number of rigid-to-rigid distance constraints.

std::uint32_t routedCableCount = 0#

Number of routed cable constraints.

std::uint32_t routedCableRoutePointCount = 0#

Total guide points across all routed cables.

std::uint32_t routedCableDebugSegmentCount#

Number of debug line segments for cable rendering.

std::uint32_t colliderCount = 0#

Total colliders registered in the scene.

std::uint64_t bindingGeneration = 0#

Revision counter for rigid scene buffer allocations.

std::uint64_t constraintBindingGeneration#

Revision counter for constraint buffer allocations.

struct PhysicsGpuSceneView#
#include <physics_gpu_scene_view.h>

Aggregate GPU scene view grouping rigid, joint, soft, and curve sub-views.

Public Members

PhysicsGpuRigidSceneView rigid = {}#

GPU view for rigid bodies, colliders, and rigid constraints.

PhysicsGpuJointSceneView joints = {}#

GPU view for articulated rigid joints.

PhysicsGpuSoftSceneView soft = {}#

GPU view for soft bodies, strands, and fluids.

PhysicsGpuCurveSceneView curve = {}#

GPU view for strand curve rendering.

struct PhysicsGpuSoftSceneView#
#include <physics_gpu_scene_view.h>

GPU buffer bindings and counts for deformable soft bodies, strands, and suturing paths.

Public Members

PhysicsGpuParticleBufferView particles = {}#

Unified particle buffer view.

Diligent::IBuffer *edgesBuffer#

GPU buffer of DeformableDistanceConstraint edge constraints.

Diligent::IBuffer *bendsBuffer#

GPU buffer of DeformableBendConstraint bending constraints.

Diligent::IBuffer *tetsBuffer#

GPU buffer of DeformableVolumeConstraint tetrahedral volume constraints.

Diligent::IBuffer *strandSegmentsBuffer#

GPU buffer of StrandSegmentConstraint descriptors.

Diligent::IBuffer *strandJointsBuffer#

GPU buffer of StrandJointConstraint descriptors.

Diligent::IBuffer *strandDistanceConstraintsBuffer#

GPU buffer of StrandDistanceConstraint descriptors.

Diligent::IBuffer *strandSegmentStatesBuffer#

GPU buffer of StrandSegmentState dynamic orientations.

Diligent::IBuffer *segmentStrandJointRangesBuffer#

GPU buffer of joint ranges incident to strand segments.

Diligent::IBuffer *segmentIncidentStrandJointsBuffer#

GPU buffer of incident strand joint indices.

Diligent::IBuffer *suturingPairsBuffer#

GPU buffer of StrandSoftSuturingPair descriptors.

Diligent::IBuffer *suturingParticleRefsBuffer#

GPU buffer of suturing particle references.

Diligent::IBuffer *suturingInsertionStatesBuffer#

GPU buffer of GpuSuturingInsertionState tracking.

Diligent::IBuffer *suturingPathHeadersBuffer#

GPU buffer of SuturingPathHeader descriptors.

Diligent::IBuffer *suturingPathNodesBuffer#

GPU buffer of SuturingPathNode interpolation points.

Diligent::IBuffer *renderPositionsBuffer#

GPU buffer of interpolated surface render vertex positions.

Diligent::IBuffer *renderNormalsBuffer#

GPU buffer of interpolated surface render vertex normals.

Diligent::IBuffer *worldAabbsBuffer#

GPU buffer of world-space AABBs for soft bodies.

std::uint32_t softBodyCount = 0#

Total soft bodies in the scene.

std::uint32_t edgeCount = 0#

Number of deformable edge constraints.

std::uint32_t bendCount = 0#

Number of deformable bending constraints.

std::uint32_t tetCount = 0#

Number of tetrahedral volume constraints.

std::uint32_t strandSegmentCount = 0#

Number of strand segments.

std::uint32_t strandJointCount = 0#

Number of strand joints.

std::uint32_t strandDistanceCount = 0#

Number of strand distance constraints.

std::uint32_t suturingPairCount = 0#

Number of active suturing interaction pairs.

std::uint32_t suturingPathHeaderCount = 0#

Number of active suturing path headers.

std::uint32_t suturingPathNodeCount = 0#

Number of generated suturing path nodes.

std::uint64_t bindingGeneration = 0#

Revision counter for soft scene buffer allocations.

class PhysicsSolver#
#include <physics_solver.h>

Primary GPU-accelerated XPBD physics simulation engine.

Manages GPU compute passes, scene buffers, broadphase spatial partitioning, narrowphase collision detection, constraint projection, and state synchronization for rigid bodies, articulated joints, soft bodies, elastic strands, and fluids.

Public Functions

explicit PhysicsSolver(gpu::GpuDevice &device, const PhysicsSolverDesc &desc = {})#

Constructs a physics solver bound to a GPU device.

Parameters:
  • device – GPU device reference providing render/compute resources.

  • desc – Initial physics solver configuration descriptor.

~PhysicsSolver()#

Destructor.

bool initialize()#

Initializes GPU compute pipelines, shader passes, and internal state buffers.

Returns:

True if initialization succeeded. With no physics-capable GPU backend, it succeeds in headless mode without creating compute pipelines.

void shutdown()#

Releases all allocated GPU pipelines, buffers, and resources.

bool step(const common::FrameContext &frameContext, PhysicsWorld &world)#

Advances the physics simulation by the time step provided in the frame context.

Parameters:
  • frameContext – Current frame index and delta time information.

  • world – Physics world containing authored entities, colliders, and constraints.

Returns:

True if simulation step completed successfully, false on execution failure.

bool syncWorldState(PhysicsWorld &world)#

Synchronizes modified authored state from the host PhysicsWorld to GPU buffers.

Parameters:

world – Physics world containing authored modifications.

Returns:

True if synchronization and upload succeeded; in headless mode this is a no-op success after initialization.

bool validateGpuMetaBlocking()#

Blocks until GPU compute work finishes and checks applicable metadata for overflow.

Metadata is read back only for broad-phase and particle-neighbor work performed by the most recent step.

Returns:

False before initialization or when no physics GPU backend is available.

void setGravity(const Diligent::float3 &gravity) noexcept#

Sets the global gravitational acceleration vector.

Parameters:

gravity – 3D gravity vector (m/s^2).

PhysicsGpuSceneView gpuSceneView() const noexcept#

Retrieves the current non-owning GPU buffer views for rigid, joint, soft, and curve scenes.

Returns:

PhysicsGpuSceneView containing pointers and descriptor counts.

const gpu::SharedExportBuffer *softPositionsInvMassSharedBuffer() const noexcept#

Returns the shared export buffer holding particle positions and inverse mass for CUDA / renderer interop.

Returns:

Pointer to SharedExportBuffer or nullptr if not created.

struct PhysicsSolverDesc#
#include <physics_solver.h>

Configuration descriptor for initializing the GPU physics solver.

Public Members

Diligent::float3 gravity = {0.0f, -9.81f, 0.0f}#

Global gravitational acceleration vector.

std::uint32_t substeps = 1#

Number of simulation substeps per frame step (>= 1).

std::uint32_t defaultIterations = 20#

Default position-solver iteration count per substep.

std::uint32_t fluidIterations#

Fluid density constraint iterations (0 uses defaultIterations).

std::uint32_t softInternalIterations#

Soft-body internal constraint iterations (0 uses defaultIterations).

std::uint32_t softContactIterations#

Soft-body contact iterations (0 uses defaultIterations).

std::uint32_t rigidJointIterations#

Rigid joint constraint iterations (0 uses defaultIterations).

std::uint32_t rigidRigidContactIterations#

Rigid-rigid contact iterations (0 uses defaultIterations).

ContactSolverSettings contact = {}#

Contact solver numerical tuning parameters.

RigidSolverSettings rigid = {}#

Rigid-body solver numerical tuning parameters.

JointSolverSettings joints = {}#

Joint constraint solver numerical tuning parameters.

SoftSolverSettings soft = {}#

Soft-body solver numerical tuning parameters.

FluidSolverSettings fluid = {}#

Fluid solver numerical tuning parameters.

bool enableBlockingReadback = true#

Whether each physics step blocks to copy GPU simulated state back to CPU host memory.

class PhysicsWorld#
#include <physics_world.h>

Host container managing authored physics scene state, rigid bodies, deformable meshes, strands, fluids, joints, and constraints.

PhysicsWorld acts as the authoring database and host synchronization bridge for CRESSim-Neo physics. It maintains authored component states (rigid bodies, colliders, soft bodies, strands, fluids, joints, constraints), transforms them into compact Structure-of-Arrays (SoA) representations for GPU uploads, tracks revision counters, and receives simulation writeback updates from GPU solvers.

Public Functions

PhysicsWorld()#

Default constructor initializing empty physics world.

~PhysicsWorld()#

Destructor releasing internal implementation resources.

PhysicsWorld(const PhysicsWorld &other)#

Copy constructor performing deep clone of world state.

Parameters:

other – Source physics world to copy.

PhysicsWorld &operator=(const PhysicsWorld &other)#

Copy assignment operator.

Parameters:

other – Source physics world to copy.

Returns:

Reference to this world.

PhysicsWorld(PhysicsWorld &&other) noexcept#

Move constructor transferring ownership of world state.

Parameters:

other – Source physics world to move from.

PhysicsWorld &operator=(PhysicsWorld &&other) noexcept#

Move assignment operator.

Parameters:

other – Source physics world to move from.

Returns:

Reference to this world.

void clear()#

Clears all bodies, colliders, joints, particles, and constraints from the world.

RigidBodyState &upsertRigidBody(const RigidBodyState &state)#

Inserts or updates an authored rigid body.

Parameters:

state – Rigid body configuration state to insert or modify.

Returns:

Reference to the stored RigidBodyState.

bool removeRigidBody(common::EntityId entityId)#

Removes a rigid body by its associated scene entity ID.

Parameters:

entityId – Entity ID of the rigid body to remove.

Returns:

True if a rigid body was found and removed, false otherwise.

void upsertCollider(const ColliderState &collider)#

Inserts or updates a single collider attachment.

Parameters:

collider – Collider state to insert or update.

bool removeCollider(ColliderId colliderId)#

Removes a collider by its ColliderId.

Parameters:

colliderId – Unique identifier of the collider to remove.

Returns:

True if found and removed, false otherwise.

void replaceColliders(common::EntityId entityId, const std::vector<ColliderState> &colliders)#

Replaces all colliders belonging to a specific entity.

Parameters:
  • entityId – Owning entity ID.

  • colliders – New list of colliders to assign.

bool upsertSoftBody(const SoftBodyState &state)#

Inserts or updates an authored 3D deformable soft body.

Parameters:

state – Soft body state.

Returns:

True if successfully inserted or updated.

bool upsertStrand(const StrandState &state)#

Inserts or updates an authored 1D elastic strand.

Parameters:

state – Strand state.

Returns:

True if successfully inserted or updated.

bool upsertFluid(const FluidState &state)#

Inserts or updates an authored fluid body.

All fluid bodies must use the same particle radius because the current fluid solve derives shared spacing-dependent parameters from that radius.

Parameters:

state – Fluid state.

Returns:

True if successfully inserted or updated; false if the source is invalid or the particle radius is incompatible with an existing fluid body.

AuthoredParticleSequenceState &upsertParticleSequence(const AuthoredParticleSequenceState &state)#

Inserts or updates an authored particle sequence.

Parameters:

state – Sequence state.

Returns:

Reference to stored sequence.

AuthoredParticleDistanceConstraintState &upsertParticleDistanceConstraint(const AuthoredParticleDistanceConstraintState &state)#

Inserts or updates an authored particle-to-particle distance constraint.

An invalid or unknown ID creates a new constraint. Negative rest length and compliance are clamped to zero. Particle references are retained as authored here and resolved when the derived state is rebuilt.

Parameters:

state – Constraint state.

Returns:

Reference to the normalized stored constraint.

bool upsertRigidParticleAttachmentConstraint(const AuthoredRigidParticleAttachmentConstraintState &state, AuthoredRigidParticleAttachmentConstraintState *outAuthored = nullptr)#

Inserts or updates an authored rigid-to-particle attachment constraint.

The referenced particle and rigid body must exist and belong to the same environment. Negative compliance is clamped to zero. An invalid or unknown constraint ID creates a new constraint; on success, outAuthored receives its normalized state when non-null.

Parameters:
  • state – Constraint state to insert or update.

  • outAuthored – Optional output pointer receiving the normalized stored constraint.

Returns:

False if either reference is invalid, out of range, or in a different environment.

bool upsertStrandRigidAttachmentConstraint(const AuthoredStrandRigidAttachmentConstraintState &state, AuthoredStrandRigidAttachmentConstraintState *outAuthored = nullptr)#

Inserts or updates an authored strand-to-rigid attachment constraint.

The strand segment and rigid body must exist and belong to the same environment. segmentT is clamped to [0, 1], the local rotation is normalized, and negative compliance values are clamped to zero. An invalid or unknown constraint ID creates a new constraint.

Parameters:
  • state – Constraint state.

  • outAuthored – Optional output pointer receiving the normalized stored state.

Returns:

False if the strand segment or rigid body is invalid, or their environments differ.

bool upsertRigidDistanceConstraint(const AuthoredRigidDistanceConstraintState &state, AuthoredRigidDistanceConstraintState *outAuthored = nullptr)#

Inserts or updates an authored rigid-to-rigid distance constraint.

The bodies must be distinct existing rigid bodies in the same environment. Negative rest distance and compliance are clamped to zero. An invalid or unknown constraint ID creates a new constraint.

Parameters:
  • state – Constraint state.

  • outAuthored – Optional output pointer receiving the normalized stored state.

Returns:

False if either body is invalid, both names refer to the same body, or environments differ.

bool upsertRoutedCableConstraint(const AuthoredRoutedCableConstraintState &state, AuthoredRoutedCableConstraintState *outAuthored = nullptr)#

Inserts or updates an authored routed cable constraint.

The route must contain at least two guide points on existing rigid bodies in one environment; adjacent guide points may not use the same body. Negative target length and compliance are clamped to zero. An invalid or unknown constraint ID creates a new constraint.

Parameters:
  • state – Constraint state.

  • outAuthored – Optional output pointer receiving the normalized stored state.

Returns:

False if the route is too short, has an invalid body, crosses environments, or repeats a body at adjacent points.

AuthoredParticleCollisionFilterState &upsertParticleCollisionFilter(const AuthoredParticleCollisionFilterState &state)#

Inserts or updates an authored particle collision filter.

An invalid or unknown filter ID creates a new filter. A zero collision layer is normalized to layer 1; the particle reference is retained as authored and resolved on rebuild.

Parameters:

state – Filter state.

Returns:

Reference to the normalized stored filter state.

AuthoredSuturingSequenceState &upsertSuturingSequence(const AuthoredSuturingSequenceState &state)#

Inserts or updates an authored suturing sequence.

An invalid or unknown ID creates a new sequence. Negative path-node spacing is clamped to zero, and the tip index is clamped to the entries (or set to zero for an empty sequence).

Parameters:

state – Sequence state.

Returns:

Reference to the normalized stored suturing sequence state.

bool removeSoftBody(common::EntityId entityId)#

Removes a soft body by its entity ID.

Parameters:

entityId – Entity ID of the soft body to remove.

Returns:

True if removed, false otherwise.

bool removeStrand(common::EntityId entityId)#

Removes a strand by its entity ID.

Parameters:

entityId – Entity ID of the strand to remove.

Returns:

True if removed, false otherwise.

bool removeFluid(common::EntityId entityId)#

Removes a fluid body by its entity ID.

Parameters:

entityId – Entity ID of the fluid to remove.

Returns:

True if removed, false otherwise.

bool removeParticleSequence(ParticleSequenceId sequenceId)#

Removes a particle sequence by its ID.

Parameters:

sequenceId – Sequence identifier to remove.

Returns:

True if removed, false otherwise.

bool removeParticleDistanceConstraint(ParticleConstraintId constraintId)#

Removes a particle distance constraint.

Parameters:

constraintId – Constraint ID to remove.

Returns:

True if removed, false otherwise.

bool removeRigidParticleAttachmentConstraint(RigidParticleAttachmentConstraintId constraintId)#

Removes a rigid-particle attachment constraint.

Parameters:

constraintId – Constraint ID to remove.

Returns:

True if removed, false otherwise.

bool removeStrandRigidAttachmentConstraint(StrandRigidAttachmentConstraintId constraintId)#

Removes a strand-rigid attachment constraint.

Parameters:

constraintId – Constraint ID to remove.

Returns:

True if removed, false otherwise.

bool removeRigidDistanceConstraint(RigidDistanceConstraintId constraintId)#

Removes a rigid distance constraint.

Parameters:

constraintId – Constraint ID to remove.

Returns:

True if removed, false otherwise.

bool removeRoutedCableConstraint(RoutedCableConstraintId constraintId)#

Removes a routed cable constraint.

Parameters:

constraintId – Constraint ID to remove.

Returns:

True if removed, false otherwise.

bool removeParticleCollisionFilter(ParticleCollisionFilterId filterId)#

Removes a particle collision filter.

Parameters:

filterId – Filter ID to remove.

Returns:

True if removed, false otherwise.

bool removeSuturingSequence(SuturingSequenceId sequenceId)#

Removes a suturing sequence.

Parameters:

sequenceId – Sequence ID to remove.

Returns:

True if removed, false otherwise.

bool upsertBallJoint(const BallJointState &state)#

Inserts or updates an articulated ball joint.

The two body IDs must name distinct registered rigid bodies in the same environment. An invalid joint ID creates a new joint.

Parameters:

state – Ball joint state.

Returns:

False if either body is invalid, both body IDs are equal, or environments differ.

bool upsertSphericalJoint(const SphericalJointState &state)#

Inserts or updates an articulated spherical joint.

The bodies must be distinct registered rigid bodies in the same environment. Rotations are normalized, negative compliance and swing limits are clamped to zero, reversed enabled twist limits are reordered, and disabled limits are reset. Only None and TargetOrientation drive modes are accepted.

Parameters:

state – Spherical joint state.

Returns:

False if the body references are invalid, environments differ, or the drive mode is unsupported.

bool upsertHingeJoint(const HingeJointState &state)#

Inserts or updates an articulated hinge joint.

The bodies must be distinct registered rigid bodies in the same environment. Rotations are normalized, negative compliance, damping, and maximum angular velocity are clamped to zero, and disabled limits are reset.

Parameters:

state – Hinge joint state.

Returns:

False if either body is invalid, both body IDs are equal, or environments differ.

bool upsertSliderJoint(const SliderJointState &state)#

Inserts or updates an articulated slider joint.

The bodies must be distinct registered rigid bodies in the same environment. Rotations are normalized, reversed enabled limits are reordered, disabled limits are reset, and negative compliance, damping, and maximum velocity are clamped to zero. When both local anchors are near zero, anchors are derived from body B’s current world position.

Parameters:

state – Slider joint state.

Returns:

False if either body is invalid, both body IDs are equal, or environments differ.

bool removeBallJoint(BallJointId jointId)#

Removes a ball joint.

Parameters:

jointId – Joint identifier to remove.

Returns:

True if removed.

bool removeSphericalJoint(SphericalJointId jointId)#

Removes a spherical joint.

Parameters:

jointId – Joint identifier to remove.

Returns:

True if removed.

bool removeHingeJoint(HingeJointId jointId)#

Removes a hinge joint.

Parameters:

jointId – Joint identifier to remove.

Returns:

True if removed.

bool removeSliderJoint(SliderJointId jointId)#

Removes a slider joint.

Parameters:

jointId – Joint identifier to remove.

Returns:

True if removed.

RigidBodyState *tryGetRigidBody(common::EntityId entityId)#

Attempts to retrieve mutable pointer to a rigid body by entity ID.

Parameters:

entityId – Entity ID of the rigid body.

Returns:

Pointer to RigidBodyState or nullptr if not found.

const RigidBodyState *tryGetRigidBody(common::EntityId entityId) const#

Attempts to retrieve const pointer to a rigid body by entity ID.

Parameters:

entityId – Entity ID of the rigid body.

Returns:

Const pointer to RigidBodyState or nullptr if not found.

const ColliderState *tryGetCollider(ColliderId colliderId) const#

Attempts to retrieve const pointer to a collider by ColliderId.

Parameters:

colliderId – Unique collider ID.

Returns:

Const pointer to ColliderState or nullptr if not found.

SoftBodyState *tryGetSoftBody(common::EntityId entityId)#

Attempts to retrieve mutable pointer to a soft body by entity ID.

Parameters:

entityId – Entity ID of the soft body.

Returns:

Pointer to SoftBodyState or nullptr if not found.

const SoftBodyState *tryGetSoftBody(common::EntityId entityId) const#

Attempts to retrieve const pointer to a soft body by entity ID.

Parameters:

entityId – Entity ID of the soft body.

Returns:

Const pointer to SoftBodyState or nullptr if not found.

StrandState *tryGetStrand(common::EntityId entityId)#

Attempts to retrieve mutable pointer to a strand by entity ID.

Parameters:

entityId – Entity ID of the strand.

Returns:

Pointer to StrandState or nullptr if not found.

const StrandState *tryGetStrand(common::EntityId entityId) const#

Attempts to retrieve const pointer to a strand by entity ID.

Parameters:

entityId – Entity ID of the strand.

Returns:

Const pointer to StrandState or nullptr if not found.

bool tryGetSoftBodyAuthoringRestPositions(common::EntityId entityId, std::vector<Diligent::float3> &outRestPositions) const#

Retrieves authoring rest positions for a soft body.

Parameters:
  • entityId – Entity ID.

  • outRestPositions[out] Output vector receiving rest positions.

Returns:

True if found and rest positions populated.

FluidState *tryGetFluid(common::EntityId entityId)#

Attempts to retrieve mutable pointer to a fluid body by entity ID.

Parameters:

entityId – Entity ID of the fluid.

Returns:

Pointer to FluidState or nullptr if not found.

const FluidState *tryGetFluid(common::EntityId entityId) const#

Attempts to retrieve const pointer to a fluid body by entity ID.

Parameters:

entityId – Entity ID of the fluid.

Returns:

Const pointer to FluidState or nullptr if not found.

AuthoredParticleSequenceState *tryGetParticleSequence(ParticleSequenceId sequenceId)#

Attempts to retrieve mutable pointer to a particle sequence.

Parameters:

sequenceId – Sequence identifier.

Returns:

Pointer to AuthoredParticleSequenceState or nullptr.

const AuthoredParticleSequenceState *tryGetParticleSequence(ParticleSequenceId sequenceId) const#

Attempts to retrieve const pointer to a particle sequence.

Parameters:

sequenceId – Sequence identifier.

Returns:

Const pointer to AuthoredParticleSequenceState or nullptr.

AuthoredParticleDistanceConstraintState *tryGetParticleDistanceConstraint(ParticleConstraintId constraintId)#

Attempts to retrieve mutable pointer to a particle distance constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Pointer to AuthoredParticleDistanceConstraintState or nullptr.

const AuthoredParticleDistanceConstraintState *tryGetParticleDistanceConstraint(ParticleConstraintId constraintId) const#

Attempts to retrieve const pointer to a particle distance constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Const pointer to AuthoredParticleDistanceConstraintState or nullptr.

AuthoredRigidParticleAttachmentConstraintState *tryGetRigidParticleAttachmentConstraint(RigidParticleAttachmentConstraintId constraintId)#

Attempts to retrieve mutable pointer to a rigid-particle attachment constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Pointer to AuthoredRigidParticleAttachmentConstraintState or nullptr.

const AuthoredRigidParticleAttachmentConstraintState *tryGetRigidParticleAttachmentConstraint(RigidParticleAttachmentConstraintId constraintId) const#

Attempts to retrieve const pointer to a rigid-particle attachment constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Const pointer to AuthoredRigidParticleAttachmentConstraintState or nullptr.

AuthoredStrandRigidAttachmentConstraintState *tryGetStrandRigidAttachmentConstraint(StrandRigidAttachmentConstraintId constraintId)#

Attempts to retrieve mutable pointer to a strand-rigid attachment constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Pointer to AuthoredStrandRigidAttachmentConstraintState or nullptr.

const AuthoredStrandRigidAttachmentConstraintState *tryGetStrandRigidAttachmentConstraint(StrandRigidAttachmentConstraintId constraintId) const#

Attempts to retrieve const pointer to a strand-rigid attachment constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Const pointer to AuthoredStrandRigidAttachmentConstraintState or nullptr.

AuthoredRigidDistanceConstraintState *tryGetRigidDistanceConstraint(RigidDistanceConstraintId constraintId)#

Attempts to retrieve mutable pointer to a rigid distance constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Pointer to AuthoredRigidDistanceConstraintState or nullptr.

const AuthoredRigidDistanceConstraintState *tryGetRigidDistanceConstraint(RigidDistanceConstraintId constraintId) const#

Attempts to retrieve const pointer to a rigid distance constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Const pointer to AuthoredRigidDistanceConstraintState or nullptr.

AuthoredRoutedCableConstraintState *tryGetRoutedCableConstraint(RoutedCableConstraintId constraintId)#

Attempts to retrieve mutable pointer to a routed cable constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Pointer to AuthoredRoutedCableConstraintState or nullptr.

const AuthoredRoutedCableConstraintState *tryGetRoutedCableConstraint(RoutedCableConstraintId constraintId) const#

Attempts to retrieve const pointer to a routed cable constraint.

Parameters:

constraintId – Constraint identifier.

Returns:

Const pointer to AuthoredRoutedCableConstraintState or nullptr.

AuthoredParticleCollisionFilterState *tryGetParticleCollisionFilter(ParticleCollisionFilterId filterId)#

Attempts to retrieve mutable pointer to a particle collision filter.

Parameters:

filterId – Filter identifier.

Returns:

Pointer to AuthoredParticleCollisionFilterState or nullptr.

const AuthoredParticleCollisionFilterState *tryGetParticleCollisionFilter(ParticleCollisionFilterId filterId) const#

Attempts to retrieve const pointer to a particle collision filter.

Parameters:

filterId – Filter identifier.

Returns:

Const pointer to AuthoredParticleCollisionFilterState or nullptr.

AuthoredSuturingSequenceState *tryGetSuturingSequence(SuturingSequenceId sequenceId)#

Attempts to retrieve mutable pointer to a suturing sequence.

Parameters:

sequenceId – Sequence identifier.

Returns:

Pointer to AuthoredSuturingSequenceState or nullptr.

const AuthoredSuturingSequenceState *tryGetSuturingSequence(SuturingSequenceId sequenceId) const#

Attempts to retrieve const pointer to a suturing sequence.

Parameters:

sequenceId – Sequence identifier.

Returns:

Const pointer to AuthoredSuturingSequenceState or nullptr.

const BallJointState *tryGetBallJoint(BallJointId jointId) const noexcept#

Attempts to retrieve const pointer to a ball joint.

Parameters:

jointId – Joint identifier.

Returns:

Const pointer to BallJointState or nullptr.

const SphericalJointState *tryGetSphericalJoint(SphericalJointId jointId) const noexcept#

Attempts to retrieve const pointer to a spherical joint.

Parameters:

jointId – Joint identifier.

Returns:

Const pointer to SphericalJointState or nullptr.

const HingeJointState *tryGetHingeJoint(HingeJointId jointId) const noexcept#

Attempts to retrieve const pointer to a hinge joint.

Parameters:

jointId – Joint identifier.

Returns:

Const pointer to HingeJointState or nullptr.

const SliderJointState *tryGetSliderJoint(SliderJointId jointId) const noexcept#

Attempts to retrieve const pointer to a slider joint.

Parameters:

jointId – Joint identifier.

Returns:

Const pointer to SliderJointState or nullptr.

const std::vector<RigidBodyState> &rigidBodySnapshot() const noexcept#

Gets snapshot vector of all authored rigid bodies.

Returns:

Const reference to rigid body state vector.

const std::vector<ColliderState> &colliderSnapshot() const noexcept#

Gets snapshot vector of all authored colliders.

Returns:

Const reference to collider state vector.

const std::vector<SoftBodyState> &softBodySnapshot() const noexcept#

Gets snapshot vector of all authored soft bodies.

Returns:

Const reference to soft body state vector.

const std::vector<StrandState> &strandSnapshot() const noexcept#

Gets snapshot vector of all authored strands.

Returns:

Const reference to strand state vector.

const std::vector<FluidState> &fluidSnapshot() const noexcept#

Gets snapshot vector of all authored fluids.

Returns:

Const reference to fluid state vector.

const std::vector<AuthoredParticleSequenceState> &particleSequenceSnapshot() const noexcept#

Gets snapshot vector of all authored particle sequences.

Returns:

Const reference to particle sequence state vector.

const std::vector<AuthoredParticleDistanceConstraintState> &particleDistanceConstraintSnapshot() const noexcept#

Gets snapshot vector of all authored particle distance constraints.

Returns:

Const reference to particle distance constraint vector.

const std::vector<AuthoredRigidParticleAttachmentConstraintState> &rigidParticleAttachmentConstraintSnapshot() const noexcept#

Gets snapshot vector of all authored rigid-particle attachment constraints.

Returns:

Const reference to rigid-particle attachment vector.

const std::vector<AuthoredStrandRigidAttachmentConstraintState> &strandRigidAttachmentConstraintSnapshot() const noexcept#

Gets snapshot vector of all authored strand-rigid attachment constraints.

Returns:

Const reference to strand-rigid attachment vector.

const std::vector<AuthoredRigidDistanceConstraintState> &rigidDistanceConstraintSnapshot() const noexcept#

Gets snapshot vector of all authored rigid-to-rigid distance constraints.

Returns:

Const reference to rigid distance constraint vector.

const std::vector<AuthoredRoutedCableConstraintState> &routedCableConstraintSnapshot() const noexcept#

Gets snapshot vector of all authored routed cable constraints.

Returns:

Const reference to routed cable constraint vector.

const std::vector<AuthoredParticleCollisionFilterState> &particleCollisionFilterSnapshot() const noexcept#

Gets snapshot vector of all authored particle collision filters.

Returns:

Const reference to particle collision filter vector.

const std::vector<AuthoredSuturingSequenceState> &suturingSequenceSnapshot() const noexcept#

Gets snapshot vector of all authored suturing sequences.

Returns:

Const reference to suturing sequence vector.

const std::vector<BallJointState> &ballJointSnapshot() const noexcept#

Gets snapshot vector of all authored ball joints.

Returns:

Const reference to ball joint state vector.

const std::vector<SphericalJointState> &sphericalJointSnapshot() const noexcept#

Gets snapshot vector of all authored spherical joints.

Returns:

Const reference to spherical joint state vector.

const std::vector<HingeJointState> &hingeJointSnapshot() const noexcept#

Gets snapshot vector of all authored hinge joints.

Returns:

Const reference to hinge joint state vector.

const std::vector<SliderJointState> &sliderJointSnapshot() const noexcept#

Gets snapshot vector of all authored slider joints.

Returns:

Const reference to slider joint state vector.

const RigidBodySoAHost &rigidBodySoA() const noexcept#

Gets the rigid body Structure-of-Arrays (SoA) host container.

Returns:

Const reference to RigidBodySoAHost.

const ColliderSoAHost &colliderSoA() const noexcept#

Gets the collider Structure-of-Arrays (SoA) host container.

Returns:

Const reference to ColliderSoAHost.

const BodyColliderMappingHost &bodyColliderMapping() const noexcept#

Gets the rigid-to-collider index mapping table.

Returns:

Const reference to BodyColliderMappingHost.

const RigidJointSceneHost &rigidJointScene() const noexcept#

Gets the combined rigid joint SoA scene container.

Returns:

Const reference to RigidJointSceneHost.

const JointCollisionSuppressionHost &jointCollisionSuppression() const noexcept#

Gets the collision suppression pairs table for connected joints.

Returns:

Const reference to JointCollisionSuppressionHost.

const ParticleSoAHost &particles() const noexcept#

Gets the unified particle Structure-of-Arrays (SoA) host container.

Returns:

Const reference to ParticleSoAHost.

const std::vector<Diligent::float4> &particleContactMaterials() const noexcept#

Gets the global particle contact material property table.

Returns:

Const reference to float4 packed material vector.

const std::vector<FluidMaterialGpu> &fluidMaterials() const noexcept#

Gets the global GPU fluid material properties table.

Returns:

Const reference to FluidMaterialGpu vector.

const std::vector<DeformableDistanceConstraint> &distanceConstraints() const noexcept#

Gets resolved deformable distance constraints.

Returns:

Const reference to DeformableDistanceConstraint vector.

const std::vector<DeformableBendConstraint> &bendConstraints() const noexcept#

Gets resolved deformable bending constraints.

Returns:

Const reference to DeformableBendConstraint vector.

const std::vector<DeformableVolumeConstraint> &volumeConstraints() const noexcept#

Gets resolved deformable volume constraints.

Returns:

Const reference to DeformableVolumeConstraint vector.

const std::vector<SoftEdge> &softEdges() const noexcept#

Gets alias view of deformable edge constraints.

Returns:

Const reference to SoftEdge vector.

const std::vector<SoftBend> &softBends() const noexcept#

Gets alias view of deformable bending constraints.

Returns:

Const reference to SoftBend vector.

const std::vector<SoftTet> &softTets() const noexcept#

Gets alias view of tetrahedral volume constraints.

Returns:

Const reference to SoftTet vector.

const std::vector<StrandSegmentConstraint> &strandSegments() const noexcept#

Gets resolved strand segment constraints.

Returns:

Const reference to StrandSegmentConstraint vector.

const std::vector<StrandJointConstraint> &strandJoints() const noexcept#

Gets resolved strand joint constraints.

Returns:

Const reference to StrandJointConstraint vector.

const std::vector<StrandDistanceConstraint> &strandDistanceConstraints() const noexcept#

Gets resolved strand distance constraints.

Returns:

Const reference to StrandDistanceConstraint vector.

const std::vector<StrandSegmentState> &strandSegmentStates() const noexcept#

Gets strand segment runtime orientation states.

Returns:

Const reference to StrandSegmentState vector.

const std::vector<RigidParticleAttachmentConstraint> &rigidParticleAttachments() const noexcept#

Gets resolved rigid-to-particle attachment constraints.

Returns:

Const reference to RigidParticleAttachmentConstraint vector.

const std::vector<StrandRigidAttachmentConstraint> &strandRigidAttachments() const noexcept#

Gets resolved strand-to-rigid attachment constraints.

Returns:

Const reference to StrandRigidAttachmentConstraint vector.

const std::vector<RigidDistanceConstraint> &rigidDistanceConstraints() const noexcept#

Gets resolved rigid distance constraints.

Returns:

Const reference to RigidDistanceConstraint vector.

const std::vector<RoutedCableConstraint> &routedCableConstraints() const noexcept#

Gets resolved routed cable constraints.

Returns:

Const reference to RoutedCableConstraint vector.

const std::vector<RoutedCableRoutePoint> &routedCableRoutePoints() const noexcept#

Gets resolved routed cable route points.

Returns:

Const reference to RoutedCableRoutePoint vector.

const std::vector<StrandSoftSuturingPair> &suturingPairs() const noexcept#

Gets surgical strand-soft tissue puncture pairs.

Returns:

Const reference to StrandSoftSuturingPair vector.

const std::vector<std::uint32_t> &suturingParticleIndices() const noexcept#

Gets global particle indices participating in suturing tracking.

Returns:

Const reference to suturing particle indices vector.

const SoftRenderDataHost &softRenderData() const noexcept#

Gets host soft-body skinning and rendering mesh bindings.

Returns:

Const reference to SoftRenderDataHost.

void setSoftRenderData(const SoftRenderDataHost &data)#

Sets host soft-body skinning and rendering mesh bindings.

Parameters:

data – Skinning and surface vertex binding data.

const CurveRenderDataHost &curveRenderData() const noexcept#

Gets host curve rendering descriptors.

Returns:

Const reference to CurveRenderDataHost.

void setCurveRenderData(const CurveRenderDataHost &data)#

Sets host curve rendering descriptors.

Parameters:

data – Curve rendering descriptor data.

void ensureDerivedStateUpToDate() const noexcept#

Ensures all derived GPU-ready SoA tables and constraints are up to date.

Although const, this call may rebuild internal cached mappings, resolved constraints, and joint/collider derived tables.

void ensureSoftBodyDerivedStateUpToDate() noexcept#

Ensures soft-body derived topology and particle layout tables are up to date.

This may rebuild particle, constraint, and suturing caches.

const std::vector<std::uint32_t> &rigidBodyDirtyIndices() const noexcept#

Gets indices of rigid bodies modified since last GPU upload.

Returns:

Vector of dirty rigid body indices.

const std::vector<std::uint32_t> &colliderDirtyIndices() const noexcept#

Gets indices of colliders modified since last GPU upload.

Returns:

Vector of dirty collider indices.

std::uint32_t rigidBodyCount() const noexcept#

Gets total number of active rigid bodies.

Returns:

Number of rigid bodies.

std::uint32_t colliderCount() const noexcept#

Gets total number of active colliders.

Returns:

Number of colliders.

std::uint32_t softBodyCount() const noexcept#

Gets total number of active soft bodies.

Returns:

Number of soft bodies.

std::uint32_t strandCount() const noexcept#

Gets total number of active strands.

Returns:

Number of strands.

std::uint32_t fluidCount() const noexcept#

Gets total number of active fluids.

Returns:

Number of fluid bodies.

bool rigidBodyCountDirty() const noexcept#

Checks if rigid body count changed requiring GPU reallocation.

Returns:

True if count is dirty.

bool colliderCountDirty() const noexcept#

Checks if collider count changed requiring GPU reallocation.

Returns:

True if count is dirty.

bool fullRigidBodyUploadRequired() const noexcept#

Checks if a full upload of all rigid bodies is required.

Returns:

True if full upload required.

bool fullColliderUploadRequired() const noexcept#

Checks if a full upload of all colliders is required.

Returns:

True if full upload required.

void clearRigidBodyUploadState() noexcept#

Clears dirty flags and indices for rigid body GPU upload tracking.

void clearColliderUploadState() noexcept#

Clears dirty flags and indices for collider GPU upload tracking.

bool staticBroadPhaseDirty() const noexcept#

Checks if static collider broadphase acceleration structures need rebuilding.

Returns:

True if static broadphase is dirty.

void clearStaticBroadPhaseDirty() noexcept#

Clears static broadphase dirty flag.

std::uint32_t activeMovingColliderCount() const noexcept#

Gets count of dynamic or kinematic (moving) colliders.

Returns:

Number of active moving colliders.

std::uint32_t staticColliderCount() const noexcept#

Gets count of static colliders.

Returns:

Number of static colliders.

float particleGridCellSize() const noexcept#

Gets spatial hashing cell dimension for particle neighbor search.

Returns:

Grid cell dimension.

std::uint32_t softBodyBoundsChunkCount() const noexcept#

Gets number of bounding box chunks for soft body broadphase.

Returns:

Chunk count.

std::uint32_t maxSuturingPathsPerPair() const noexcept#

Gets maximum suturing paths allocated per needle-soft pair.

Returns:

Path capacity.

std::uint32_t maxSuturingNodesPerPath() const noexcept#

Gets maximum nodes allocated per suturing path.

Returns:

Node capacity.

std::uint32_t suturingParticleCount() const noexcept#

Gets number of particles participating in suturing tracking.

Returns:

Particle count.

std::uint32_t reservedSuturingPathHeaderCount() const noexcept#

Gets total reserved suturing path header count in GPU buffer.

Returns:

Header buffer size.

std::uint32_t reservedSuturingPathNodeCount() const noexcept#

Gets total reserved suturing path node count in GPU buffer.

Returns:

Node buffer size.

void integrateRigidBodiesCpu(float dt) noexcept#

Advances rigid body motion on CPU for simple kinematic/dynamic steps.

Parameters:

dt – Time step size in seconds.

bool syncRigidBodyStateFromSimulation(std::uint32_t index, const Diligent::float4 &positionInvMass, const Diligent::float4 &orientation, const Diligent::float4 &linearVelocity, const Diligent::float4 &angularVelocity) noexcept#

Synchronizes a rigid body’s pose and velocities back from GPU simulation.

Parameters:
  • index – Rigid body index in SoA.

  • positionInvMass – New world position and inverse mass.

  • orientation – New orientation quaternion.

  • linearVelocity – New linear velocity vector.

  • angularVelocity – New angular velocity vector.

Returns:

True if synchronization succeeded.

void finalizeRigidBodyWriteback() noexcept#

Finalizes rigid body state writeback into snapshot structures.

bool syncParticleStateFromSimulation(std::uint32_t index, const Diligent::float4 &positionInvMass, const Diligent::float4 &previousPosition, const Diligent::float4 &velocity) noexcept#

Synchronizes a particle’s position and velocity back from GPU simulation.

Parameters:
  • index – Particle index in SoA.

  • positionInvMass – New world position and inverse mass.

  • previousPosition – Previous sub-step position.

  • velocity – New velocity vector.

Returns:

True if synchronization succeeded.

void finalizeParticleWriteback() noexcept#

Finalizes particle state writeback into snapshot structures.

std::uint64_t authoredRevision() const noexcept#

Monotonically increasing revision counter incremented on any authored scene change.

Returns:

Authoring revision number.

std::uint64_t simulationRevision() const noexcept#

Monotonically increasing revision counter incremented on simulation step writeback.

Returns:

Simulation revision number.

std::uint64_t rigidBodyTopologyRevision() const noexcept#

Revision counter tracking rigid body count and topology changes.

Returns:

Revision number.

std::uint64_t rigidJointTopologyRevision() const noexcept#

Revision counter tracking rigid joint count and topology changes.

Returns:

Revision number.

std::uint64_t rigidJointSceneRevision() const noexcept#

Revision counter tracking joint parameter changes.

Returns:

Revision number.

std::uint64_t rigidJointModeRevision() const noexcept#

Revision counter tracking joint drive mode changes.

Returns:

Revision number.

std::uint64_t softBodyTopologyRevision() const noexcept#

Revision counter tracking soft body entity topology changes.

Returns:

Revision number.

std::uint64_t softParticleRevision() const noexcept#

Revision counter tracking particle count and memory layout changes.

Returns:

Revision number.

std::uint64_t softTopologyRevision() const noexcept#

Revision counter tracking internal soft body constraint topologies.

Returns:

Revision number.

std::uint64_t softConstraintAdjacencyRevision() const noexcept#

Revision counter tracking constraint adjacency and neighbor graph updates.

Returns:

Revision number.

std::uint64_t rigidParticleAttachmentDefinitionRevision() const noexcept#

Revision counter tracking rigid-particle attachment authoring changes.

Returns:

Revision number.

std::uint64_t rigidParticleAttachmentResolvedRevision() const noexcept#

Revision counter tracking resolved GPU rigid-particle attachments.

Returns:

Revision number.

std::uint64_t strandRigidAttachmentDefinitionRevision() const noexcept#

Revision counter tracking strand-rigid attachment authoring changes.

Returns:

Revision number.

std::uint64_t strandRigidAttachmentResolvedRevision() const noexcept#

Revision counter tracking resolved GPU strand-rigid attachments.

Returns:

Revision number.

std::uint64_t rigidDistanceConstraintDefinitionRevision() const noexcept#

Revision counter tracking rigid distance constraint authoring changes.

Returns:

Revision number.

std::uint64_t rigidDistanceConstraintResolvedRevision() const noexcept#

Revision counter tracking resolved GPU rigid distance constraints.

Returns:

Revision number.

std::uint64_t routedCableDefinitionRevision() const noexcept#

Revision counter tracking routed cable constraint authoring changes.

Returns:

Revision number.

std::uint64_t routedCableResolvedRevision() const noexcept#

Revision counter tracking resolved GPU routed cable constraints.

Returns:

Revision number.

std::uint64_t curveRenderRevision() const noexcept#

Revision counter tracking curve rendering descriptors.

Returns:

Revision number.

struct RigidBodySoAGpu#
#include <physics_types.h>

GPU metadata descriptor for rigid body SoA buffers.

Public Members

std::uint32_t bodyCount = 0#
std::uint32_t capacity = 0#
struct RigidBodySoAHost#
#include <physics_types.h>

Structure-of-Arrays (SoA) host memory container holding rigid-body attributes.

Public Functions

inline std::size_t size() const noexcept#
inline bool empty() const noexcept#
inline void clear()#

Public Members

std::vector<RigidBodyId> rigidBodyIds#
std::vector<common::EntityId> entityIds#
std::vector<std::uint32_t> environmentIndices#
std::vector<Diligent::float4> positionsInvMass#
std::vector<Diligent::float4> orientations#
std::vector<Diligent::float4> scales#
std::vector<Diligent::float4> linearVelocities#
std::vector<Diligent::float4> angularVelocities#
std::vector<Diligent::float4> inverseInertiaLocal#
std::vector<std::uint32_t> bodyTypes#
std::vector<Diligent::float4> kinematicTargetPositions#
std::vector<Diligent::float4> kinematicTargetOrientations#
std::vector<std::uint32_t> kinematicTargetFlags#
std::vector<Diligent::float4> proxyParticleContactMaterials#
struct RigidBodyState#
#include <physics_types.h>

Complete dynamic and kinematic state descriptor for an authored rigid body.

Public Members

RigidBodyId rigidBodyId = kInvalidRigidBodyId#

Assigned rigid body identifier.

common::EntityId entityId = common::kInvalidEntityId#

Associated ECS scene entity ID.

std::uint32_t environmentIndex = 0u#

Multi-environment partition index.

Diligent::float3 position = {0.0f, 0.0f, 0.0f}#

Center-of-mass world position (x, y, z).

Diligent::QuaternionF rotation = {0.0f, 0.0f, 0.0f, 1.0f}#

World orientation quaternion.

Diligent::float3 scale = {1.0f, 1.0f, 1.0f}#

3D scale factors.

Diligent::float3 linearVelocity = {0.0f, 0.0f, 0.0f}#

Linear velocity vector (m/s).

Diligent::float3 angularVelocity = {0.0f, 0.0f, 0.0f}#

Angular velocity vector (rad/s).

Diligent::float3 inverseInertiaLocal#

Diagonal elements of inverted body-local inertia tensor.

RigidBodyType bodyType#

Rigid body simulation type (Static, Kinematic, Dynamic).

float inverseMass = 1.0f#

Reciprocal mass (1/m), 0 for static bodies.

Diligent::float3 kinematicTargetPosition#

Kinematic target position when driven.

Diligent::QuaternionF kinematicTargetRotation#

Kinematic target rotation when driven.

bool kinematicTargetEnabled = false#

Whether kinematic target driving is active.

float proxyParticleRadius = 0.0f#

Radius of proxy collision particles.

ParticleContactMaterialDesc proxyParticleMaterial = {}#

Contact material for proxy collision particles.

std::uint32_t proxyCollisionLayer = 1u#

Collision layer bit for proxy particles.

std::uint32_t proxyCollisionMask#

Collision mask bitfield for proxy particles.

std::uint32_t proxyParticleOffset = 0u#

Offset into global particle buffer.

std::uint32_t proxyParticleCount#

Number of proxy particles attached to this rigid body.

std::uint32_t proxyParticleMaterialIndex = 0u#

Material table index for proxy contact.

bool suturingEnabled#

Whether proxy particles participate in suturing needle puncture tracking.

std::uint32_t needleTipProxyIndex = 0u#

Proxy particle index acting as the needle tip.

Diligent::float4 proxyParticleContactMaterial#

Packed proxy contact material.

std::vector<Diligent::float3> proxyParticleLocalPositions#

Local-space positions of rigid proxy particles.

struct RigidDistanceConstraint#
#include <physics_types.h>

GPU runtime descriptor for a rigid-to-rigid distance constraint.

Public Members

std::uint32_t rigidBodyIndexA = 0u#

First rigid body index.

std::uint32_t rigidBodyIndexB = 0u#

Second rigid body index.

float restDistance = 0.0f#

Rest separation distance.

float compliance = 0.0f#

Distance compliance.

std::uint32_t enabled = 1u#

Active state flag.

std::uint32_t reserved0 = 0u#

Reserved padding.

Diligent::float4 localAnchorA = {0.0f, 0.0f, 0.0f, 0.0f}#

Local anchor offset in body A.

Diligent::float4 localAnchorB = {0.0f, 0.0f, 0.0f, 0.0f}#

Local anchor offset in body B.

struct RigidJointSceneHost#
#include <physics_types.h>

Combined host SoA container for all joint categories (ball, spherical, hinge, slider).

Public Functions

inline void clear()#
struct RigidParticleAttachmentConstraint#
#include <physics_types.h>

GPU runtime descriptor for an attachment constraint between a particle and rigid body.

Public Members

std::uint32_t particleIndex = 0u#

Target particle index.

std::uint32_t rigidBodyIndex = 0u#

Target rigid body index.

float compliance = 0.0f#

Attachment compliance.

std::uint32_t enabled = 1u#

Active state flag.

Diligent::float4 localAnchor = {0.0f, 0.0f, 0.0f, 0.0f}#

Local anchor offset on rigid body.

struct RigidSolverSettings#
#include <physics_solver.h>

Numerical stabilization and clamp parameters for rigid-body position and velocity solvers.

Occupies 32 bytes to match its GPU uniform counterpart layout.

Public Members

float depenetrationBaumgarte = 0.25f#

Baumgarte stabilization factor for depenetration.

float depenetrationRelaxation = 0.90f#

Relaxation coefficient for rigid depenetration.

float depenetrationMaxCorrectionPerIteration#

Maximum depenetration position correction per iteration.

float velocityPenetrationStiffness#

Penetration stiffness coefficient for velocity projection.

float maxTranslationCorrectionPerIteration#

Maximum translation clamp per iteration.

float maxRotationCorrectionPerIteration#

Maximum angular rotation correction clamp per iteration.

float maxLinearVelocityCorrectionPerIteration#

Maximum linear velocity update clamp per iteration.

float maxAngularVelocityCorrectionPerIteration#

Maximum angular velocity update clamp per iteration.

struct RoutedCableConstraint#
#include <physics_types.h>

GPU runtime descriptor for a routed cable constraint.

Public Members

std::uint32_t routePointStart = 0u#

Start offset in route points buffer.

std::uint32_t routePointCount = 0u#

Total guide points.

float targetLength = 0.0f#

Target cable length.

float compliance = 0.0f#

Compliance coefficient.

std::uint32_t tensionOnly = 1u#

True (1) if cable resists stretching only.

std::uint32_t enabled = 1u#

Active state flag.

std::uint32_t reserved1 = 0u#

Reserved padding.

std::uint32_t reserved2 = 0u#

Reserved padding.

struct RoutedCableRoutePoint#
#include <physics_types.h>

GPU runtime descriptor for a routed cable guide point.

Public Members

std::uint32_t rigidBodyIndex = 0u#

Hosting rigid body index.

std::uint32_t reserved0 = 0u#

Reserved padding.

std::uint32_t reserved1 = 0u#

Reserved padding.

std::uint32_t reserved2 = 0u#

Reserved padding.

Diligent::float4 localGuideOffset#

Local guide coordinate offset on rigid body.

struct SliderJointSoAHost#
#include <physics_types.h>

Structure-of-Arrays (SoA) host memory container holding slider joint descriptors.

Public Functions

inline std::size_t size() const noexcept#
inline bool empty() const noexcept#
inline void clear()#

Public Members

std::vector<std::uint32_t> bodyIndicesA#
std::vector<std::uint32_t> bodyIndicesB#
std::vector<std::uint32_t> enabledFlags#
std::vector<std::uint32_t> driveModes#
std::vector<Diligent::float4> localAnchorsA#
std::vector<Diligent::float4> localAnchorsB#
std::vector<std::uint32_t> limitEnabledFlags#
std::vector<float> limitMins#
std::vector<float> limitMaxs#
std::vector<float> constraintCompliances#
std::vector<float> driveCompliances#
std::vector<float> driveDampings#
std::vector<float> driveMaxVelocities#
std::vector<float> driveTargetPositions#
std::vector<float> driveTargetVelocities#
std::vector<float> driveRestOffsets#
std::vector<Diligent::float4> localAxesA0#
std::vector<Diligent::float4> localAxesA1#
std::vector<Diligent::float4> localAxesA2#
std::vector<Diligent::float4> projectionRow0#
std::vector<Diligent::float4> projectionRow1#
std::vector<Diligent::float4> projectionRow2#
struct SliderJointState#
#include <physics_types.h>

State descriptor for a 1-DOF prismatic slider joint with linear travel limits and linear actuator drive.

Public Members

SliderJointId jointId = kInvalidSliderJointId#

Unique joint identifier.

bool enabled = true#

Active state flag.

bool suppressConnectedBodyCollisions = false#

Suppress collision between connected bodies.

RigidJointDriveMode driveMode = RigidJointDriveMode::None#

Drive control mode.

bool limitEnabled = false#

Whether linear travel limits are enabled.

RigidBodyId bodyA = kInvalidRigidBodyId#

First connected body ID.

RigidBodyId bodyB = kInvalidRigidBodyId#

Second connected body ID.

Diligent::float3 localAnchorA = {0.0f, 0.0f, 0.0f}#

Anchor in body A local space.

Diligent::float3 localAnchorB = {0.0f, 0.0f, 0.0f}#

Anchor in body B local space.

Diligent::QuaternionF localRotationA = {0.0f, 0.0f, 0.0f, 1.0f}#

Slider axis frame in body A.

Diligent::QuaternionF localRotationB = {0.0f, 0.0f, 0.0f, 1.0f}#

Slider axis frame in body B.

float limitMin = 0.0f#

Minimum linear translation limit (m).

float limitMax = 0.0f#

Maximum linear translation limit (m).

float constraintCompliance = 0.0f#

Slider constraint compliance.

float driveCompliance = 0.0f#

Linear drive compliance.

float driveDamping = 0.0f#

Damping coefficient for slider drive.

float driveMaxVelocity = 0.0f#

Maximum linear velocity clamp for drive.

float driveTargetPosition = 0.0f#

Target position for position drive (m).

float driveTargetVelocity = 0.0f#

Target velocity for velocity drive (m/s).

struct SoftBodyMaterialDesc#
#include <physics_types.h>

Material parameters for deformable soft bodies.

Public Members

ParticleContactMaterialDesc contact = {}#

Contact interaction properties.

struct SoftBodyMeshfreeParticleSource#
#include <physics_types.h>

Source parameters for meshfree particle-based soft bodies.

Public Members

std::vector<Diligent::float3> particleRestPositions#

Interior simulation particle positions.

std::vector<Diligent::float3> surfaceRestPositions#

High-resolution surface mesh vertex coordinates.

std::vector<Diligent::float3> surfaceNormals#

Surface normal vectors.

std::vector<Diligent::uint3> surfaceTriangles#

Surface triangle indices.

std::vector<std::uint32_t> staticParticleIndices#

Local particle indices fixed in space.

std::uint32_t neighbourCount#

Number of nearest neighbors per particle for shape matching.

struct SoftBodyRegularGridSource#
#include <physics_types.h>

Source parameters for generating a regular voxel grid soft body.

Public Members

Diligent::float3 size = {1.0f, 1.0f, 1.0f}#

3D box extents of the grid volume.

float targetParticleSpacing = 0.25f#

Desired inter-particle spacing distance.

std::vector<std::uint32_t> staticParticleIndices#

Local particle indices fixed in space (infinite mass).

struct SoftBodySourceDesc#
#include <physics_types.h>

Discriminated union descriptor selecting the geometry source for a soft body.

Public Members

SoftBodySourceKind kind = SoftBodySourceKind::RegularGrid#

Selected source kind.

SoftBodyRegularGridSource regularGrid#

Grid configuration (used when kind == RegularGrid).

SoftBodyTetMeshSource tetMesh#

Explicit mesh configuration (used when kind == TetMesh).

SoftBodyTetGenSource tetGen#

TetGen file paths (used when kind == TetGenFiles).

SoftBodyMeshfreeParticleSource meshfreeParticles#

Meshfree configuration (used when kind == MeshfreeParticles).

struct SoftBodyState#
#include <physics_types.h>

State descriptor for an authored 3D deformable tetrahedral or meshfree soft body.

Public Members

common::EntityId entityId = common::kInvalidEntityId#

Associated ECS entity ID.

std::uint32_t environmentIndex = 0u#

Multi-environment index.

std::uint32_t collisionLayer = 1u#

Collision layer bitmask.

std::uint32_t collisionMask = 0xffffffffu#

Collision filtering bitmask.

bool supportsSuturing = false#

Whether this soft body can be pierced by surgical sutures.

SoftBodySourceDesc source = {}#

Geometry source definition.

SoftBodyMaterialDesc material = {}#

Soft-body contact material properties.

common::Transform restTransform = {}#

Initial rest transform pose in world space.

float particleMass = 1.0f#

Mass per soft-body particle.

float particleRadius = 0.125f#

Collision radius per particle.

float edgeCompliance = 0.0f#

Distance/elastic edge constraint compliance.

float volumeCompliance = 0.0f#

Tetrahedral hydrostatic volume constraint compliance.

bool selfCollisionEnabled#

Whether particles of this soft body collide with one another.

std::uint32_t contactMaterialIndex = 0u#

Index into contact material table.

std::uint32_t particleOffset = 0u#

Start offset in global particle buffer.

std::uint32_t particleCount = 0u#

Number of particles in this soft body.

std::uint32_t edgeOffset = 0u#

Start offset in global edge constraint buffer.

std::uint32_t edgeCount = 0u#

Number of distance edge constraints.

std::uint32_t tetOffset = 0u#

Start offset in tetrahedral constraint buffer.

std::uint32_t tetCount = 0u#

Number of tetrahedral volume constraints.

std::vector<Diligent::float3> restPositions#

Object-space rest positions of particles.

std::vector<Diligent::uint3> boundaryFaces#

Triangle indices for surface boundary rendering.

struct SoftBodyTetGenSource#
#include <physics_types.h>

Source parameters for loading a tetrahedral soft body from TetGen format files.

Public Members

std::string nodeFile#

Path to .node vertex coordinate file.

std::string eleFile#

Path to .ele tetrahedral element file.

std::vector<std::uint32_t> staticParticleIndices#

Local particle indices fixed in space.

struct SoftBodyTetMeshSource#
#include <physics_types.h>

Source parameters for generating a soft body from an explicit tetrahedral mesh.

Public Members

std::vector<Diligent::float3> objectSpaceRestPositions#

Rest coordinates of mesh vertices.

std::vector<std::uint32_t> tetVertexIndices#

4-tuples of vertex indices defining tetrahedra.

std::vector<std::uint32_t> staticParticleIndices#

Local particle indices fixed in space.

struct SoftRenderDataHost#
#include <physics_types.h>

Host container for soft body surface rendering data and barycentric vertex bindings.

Public Functions

inline void clear()#

Public Members

std::vector<SoftRenderVertexBinding> vertexBindings#
std::vector<Diligent::float4> fallbackNormals#
std::vector<SoftRenderVertexTriangleRange> vertexTriangleRanges#
std::vector<std::uint32_t> vertexTriangleIndices#
std::vector<Diligent::uint4> triangleParticleIndices#
std::vector<Diligent::uint2> softBodyParticleRanges#
struct SoftRenderVertexBinding#
#include <physics_types.h>

Skinning binding connecting a render surface vertex to four simulation particles.

Public Members

Diligent::uint4 particleIndices = {0u, 0u, 0u, 0u}#

Four simulation particle indices.

Diligent::float4 weights = {1.0f, 0.0f, 0.0f, 0.0f}#

Interpolation weights summing to 1.0.

struct SoftRenderVertexTriangleRange#
#include <physics_types.h>

Vertex-to-triangle mapping range for surface normal computation.

Public Members

std::uint32_t start = 0u#
std::uint32_t count = 0u#
std::uint32_t reserved0 = 0u#
std::uint32_t reserved1 = 0u#
struct SoftSolverSettings#
#include <physics_solver.h>

Numerical relaxation parameters for soft-body internal constraint solving.

Occupies 32 bytes to match its GPU uniform counterpart layout.

Public Members

float internalRelaxation#

Relaxation factor for distance, bending, and tetrahedral volume constraints.

float reserved0 = 0.0f#

Reserved padding.

float reserved1 = 0.0f#

Reserved padding.

float reserved2 = 0.0f#

Reserved padding.

float reserved3 = 0.0f#

Reserved padding.

float reserved4 = 0.0f#

Reserved padding.

float reserved5 = 0.0f#

Reserved padding.

float reserved6 = 0.0f#

Reserved padding.

struct SphericalJointSoAHost#
#include <physics_types.h>

Structure-of-Arrays (SoA) host memory container holding spherical joint descriptors.

Public Functions

inline std::size_t size() const noexcept#
inline bool empty() const noexcept#
inline void clear()#

Public Members

std::vector<std::uint32_t> bodyIndicesA#
std::vector<std::uint32_t> bodyIndicesB#
std::vector<std::uint32_t> enabledFlags#
std::vector<std::uint32_t> driveModes#
std::vector<Diligent::float4> localAnchorsA#
std::vector<Diligent::float4> localAnchorsB#
std::vector<Diligent::float4> localRotationsA#
std::vector<Diligent::float4> localRotationsB#
std::vector<std::uint32_t> limitEnabledFlags#
std::vector<float> swingLimitYs#
std::vector<float> swingLimitZs#
std::vector<float> twistLimitMins#
std::vector<float> twistLimitMaxs#
std::vector<float> constraintCompliances#
std::vector<float> swingCompliances#
std::vector<float> twistCompliances#
std::vector<float> driveCompliances#
std::vector<Diligent::float4> driveTargetOrientations#
struct SphericalJointState#
#include <physics_types.h>

State descriptor for a 3-DOF spherical joint with swing limits, twist limits, and orientation drive.

Public Members

SphericalJointId jointId = kInvalidSphericalJointId#

Unique joint identifier.

bool enabled = true#

Active state flag.

bool suppressConnectedBodyCollisions = false#

Suppress collision between connected bodies.

RigidJointDriveMode driveMode = RigidJointDriveMode::None#

Drive control mode.

bool limitEnabled = false#

Whether swing/twist limits are enabled.

RigidBodyId bodyA = kInvalidRigidBodyId#

First connected body ID.

RigidBodyId bodyB = kInvalidRigidBodyId#

Second connected body ID.

Diligent::float3 localAnchorA = {0.0f, 0.0f, 0.0f}#

Anchor in body A local space.

Diligent::float3 localAnchorB = {0.0f, 0.0f, 0.0f}#

Anchor in body B local space.

Diligent::QuaternionF localRotationA = {0.0f, 0.0f, 0.0f, 1.0f}#

Joint frame in body A.

Diligent::QuaternionF localRotationB = {0.0f, 0.0f, 0.0f, 1.0f}#

Joint frame in body B.

float swingLimitY = 0.0f#

Maximum swing angle about joint Y axis (radians).

float swingLimitZ = 0.0f#

Maximum swing angle about joint Z axis (radians).

float twistLimitMin = 0.0f#

Minimum twist angle limit (radians).

float twistLimitMax = 0.0f#

Maximum twist angle limit (radians).

float constraintCompliance = 0.0f#

Anchor position compliance.

float swingCompliance = 0.0f#

Swing-limit compliance.

float twistCompliance = 0.0f#

Twist-limit compliance.

float driveCompliance = 0.0f#

Orientation drive compliance.

Diligent::QuaternionF driveTargetOrientation#

Target orientation for drive.

struct StrandDistanceConstraint#
#include <physics_types.h>

Distance constraint between strand particle nodes.

Public Members

std::uint32_t particleA = 0u#

First particle index.

std::uint32_t particleB = 0u#

Second particle index.

float restLength = 0.0f#

Target rest separation distance.

float distanceCompliance = 0.0f#

Distance compliance.

struct StrandJointConstraint#
#include <physics_types.h>

Angular joint constraint connecting two adjacent strand segments.

Public Members

std::uint32_t segmentA = 0u#

First strand segment index.

std::uint32_t segmentB = 0u#

Second strand segment index.

float bendCompliance = 0.0f#

Bending compliance.

float twistCompliance = 0.0f#

Torsional twisting compliance.

Diligent::float4 restRelativeOrientation#

Rest relative rotation between segments.

struct StrandMaterialDesc#
#include <physics_types.h>

Material parameters for elastic strands.

Public Members

ParticleContactMaterialDesc contact = {}#

Contact interaction properties.

struct StrandRigidAttachmentConstraint#
#include <physics_types.h>

GPU runtime descriptor for a one-way rigid-driven strand follow attachment.

Public Members

std::uint32_t segmentIndex = 0u#

Attached strand segment index.

std::uint32_t rigidBodyIndex = 0u#

Driving rigid body index.

float segmentT = 0.0f#

Parametric position [0, 1] on segment.

float translationCompliance = 0.0f#

Translation compliance.

float rotationCompliance = 0.0f#

Orientation compliance.

std::uint32_t enabled = 1u#

Active state flag.

std::uint32_t reserved1 = 0u#

Reserved padding.

std::uint32_t reserved2 = 0u#

Reserved padding.

Diligent::float4 localAnchor = {0.0f, 0.0f, 0.0f, 0.0f}#

Local anchor on rigid body.

Diligent::float4 localRotation#

Local relative orientation on rigid body.

struct StrandSegmentConstraint#
#include <physics_types.h>

Segment constraint connecting adjacent particles along an elastic strand.

Public Members

std::uint32_t particleA = 0u#

First particle node.

std::uint32_t particleB = 0u#

Second particle node.

float restLength = 0.0f#

Segment rest length.

float stretchShearCompliance = 0.0f#

Stretching and shearing compliance.

Diligent::float4 restOrientation#

Rest segment orientation quaternion.

struct StrandSegmentState#
#include <physics_types.h>

Dynamic runtime orientation state of a strand segment.

Public Members

Diligent::float4 orientation#

Current segment orientation quaternion.

struct StrandSoftSuturingPair#
#include <physics_types.h>

Pairing descriptor binding a surgical strand to a deformable soft body for needle puncture tracking.

Public Members

std::uint32_t suturingGroupId = kInvalidSuturingIndex#

Suturing interaction group ID.

std::uint32_t softBodyIndex = kInvalidSuturingIndex#

Target soft-body index.

std::uint32_t strandParticleStart = 0u#

Start offset of strand particles.

std::uint32_t strandParticleCount = 0u#

Number of strand particles.

std::uint32_t tipParticleIndex#

Particle index designated as needle tip.

std::uint32_t softTetStart = 0u#

Start offset of soft-body tetrahedra.

std::uint32_t softTetCount = 0u#

Number of soft-body tetrahedra.

std::uint32_t pathStart = 0u#

Offset into path header buffer.

std::uint32_t pathCount = 0u#

Number of paths allocated.

std::uint32_t nodeStart = 0u#

Offset into path node buffer.

std::uint32_t nodeCount = 0u#

Maximum path node capacity.

std::uint32_t activePathIndex = kInvalidSuturingIndex#

Currently active path index.

std::uint32_t environmentIndex = 0u#

Environment index.

float pathNodeSpacing = 0.0f#

Node sampling interval along path.

std::uint32_t reserved0 = 0u#

Reserved padding.

std::uint32_t reserved1 = 0u#

Reserved padding.

struct StrandState#
#include <physics_types.h>

State descriptor for an authored 1D elastic Cosserat-like strand or surgical suture thread.

Public Members

common::EntityId entityId = common::kInvalidEntityId#

Associated ECS entity ID.

std::uint32_t environmentIndex = 0u#

Multi-environment index.

std::uint32_t collisionLayer = 1u#

Collision layer bitmask.

std::uint32_t collisionMask = 0xffffffffu#

Collision filter bitmask.

bool suturingEnabled = false#

Whether suturing needle tracking is active for this strand.

float pathNodeSpacing = 0.2f#

Node sampling interval when generating puncture paths.

StrandMaterialDesc material = {}#

Strand contact material parameters.

float particleMass = 1.0f#

Mass per node particle.

float particleRadius = 0.125f#

Collision radius per node particle.

float stretchShearCompliance = 0.0f#

Stretch and shear compliance coefficient.

float bendCompliance = 0.0f#

Bending compliance coefficient.

float twistCompliance = 0.0f#

Torsional twist compliance coefficient.

float distanceCompliance = 0.0f#

Segment distance compliance coefficient.

Diligent::float3 rootMaterialNormal#

Normal vector at the root node for orientation framing.

bool selfCollisionEnabled = false#

Whether strand nodes collide with one another.

std::uint32_t contactMaterialIndex = 0u#

Index in contact material table.

std::uint32_t particleOffset = 0u#

Start offset in global particle buffer.

std::uint32_t particleCount = 0u#

Number of particle nodes in this strand.

std::uint32_t segmentOffset = 0u#

Start offset in strand segment buffer.

std::uint32_t segmentCount = 0u#

Number of segments in this strand.

std::uint32_t jointOffset = 0u#

Start offset in strand joint buffer.

std::uint32_t jointCount = 0u#

Number of inter-segment joints in this strand.

std::vector<Diligent::float3> restPositions#

Node rest positions in object space.

std::vector<std::uint32_t> staticParticleIndices#

Node indices fixed in space.

struct SurfaceMeshData#
#include <load_surface_mesh.h>

Surface geometry representation comprising vertex positions, normals, and triangle indices.

Public Members

std::vector<Diligent::float3> surfaceRestPositions#

Object-space rest positions of mesh vertices.

std::vector<Diligent::float3> surfaceNormals#

Per-vertex surface normal vectors.

std::vector<Diligent::uint3> surfaceTriangles#

Triangle index triplets indexing vertex arrays.

struct SuturingPathHeader#
#include <physics_types.h>

Header metadata for an authored or generated suturing path through soft tissue.

Public Members

std::uint32_t suturingGroupId#

Identifier for the suturing interaction group.

std::uint32_t softBodyIndex = kInvalidSuturingIndex#

Index of the pierced soft body.

std::uint32_t nodeStart = 0u#

Start offset into the path node buffer.

std::uint32_t nodeCount = 0u#

Total nodes in this path.

std::uint32_t flags = 0u#

Path status flags.

std::uint32_t reserved0 = 0u#

Reserved padding.

std::uint32_t reserved1 = 0u#

Reserved padding.

std::uint32_t reserved2 = 0u#

Reserved padding.

struct SuturingPathNode#
#include <physics_types.h>

Single interpolation node along a punctured suturing path.

Public Members

std::uint32_t softBodyIndex = 0xffffffffu#

Soft body index.

std::uint32_t tetIndex = 0xffffffffu#

Containing tetrahedron index.

Diligent::float4 barycentrics = {0.0f, 0.0f, 0.0f, 0.0f}#

Interpolated barycentric weights.

Diligent::float3 tangent = {0.0f, 0.0f, 0.0f}#

Tangent direction of path at this node.

float arcLength = 0.0f#

Cumulative arc-length distance along path.