Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
SoftBodySystem.cpp File Reference
#include "Physics.pch.hpp"
#include "exception/SoftBodyError.hpp"
#include "system/SoftBodySystem.hpp"
#include "Logger.hpp"
#include "component/BoxCollider.hpp"
#include "component/CapsuleCollider.hpp"
#include "component/SoftBody.hpp"
#include "component/SoftBodyInternal.hpp"
#include "component/SphereCollider.hpp"
#include "resource/BodyEntityMap.hpp"
#include "resource/PhysicsManager.hpp"
#include "utils/JoltConversions.hpp"
#include "utils/Layers.hpp"
#include <fmt/format.h>
#include <set>
#include <unordered_map>
#include "Object.hpp"
#include "utils/MeshUtils.hpp"
#include <Jolt/Physics/Body/BodyCreationSettings.h>
#include <Jolt/Physics/SoftBody/SoftBodyCreationSettings.h>
#include <Jolt/Physics/SoftBody/SoftBodyMotionProperties.h>
#include <Jolt/Physics/SoftBody/SoftBodySharedSettings.h>

Classes

struct  Physics::System::Vec3Hash
 Hash function for glm::vec3 to use in unordered_map. More...
struct  Physics::System::Vec3Equal
 Equality function for glm::vec3 (exact comparison). More...
struct  Physics::System::DeduplicatedMesh
 Structure holding deduplicated mesh data for Jolt soft body. More...
struct  Physics::System::CreateSettingsResult
 Result of creating Jolt shared settings, includes vertex mapping. More...

Namespaces

namespace  Physics
namespace  Physics::System

Functions

static std::vector< std::pair< uint32_t, uint32_t > > Physics::System::GenerateEdgesFromFaces (const std::vector< uint32_t > &faceIndices)
 Generate edge constraints from triangle face indices.
static DeduplicatedMesh Physics::System::DeduplicateMesh (const Object::Component::Mesh &mesh)
 Convert a potentially "flat" mesh (with duplicated vertices) to an indexed mesh with unique vertices.
static CreateSettingsResult Physics::System::CreateJoltSharedSettings (const Component::SoftBody &softBody, const Object::Component::Mesh &mesh, const glm::vec3 &scale=glm::vec3(1.0f))
 Convert SoftBody component to Jolt SoftBodySharedSettings.
static JPH::SoftBodyCreationSettings Physics::System::CreateJoltCreationSettings (const Component::SoftBody &softBody, const JPH::Ref< JPH::SoftBodySharedSettings > &sharedSettings, const JPH::RVec3 &position, const JPH::Quat &rotation)
 Create Jolt SoftBodyCreationSettings from component.
static void Physics::System::OnSoftBodyConstruct (Engine::Core::Registry &registry, Engine::EntityId entityId)
static void Physics::System::OnSoftBodyInternalConstruct (Engine::Core::Registry &registry, Engine::EntityId entityId)
static void Physics::System::OnSoftBodyDestroy (Engine::Core::Registry &registry, Engine::EntityId entityId)
static void Physics::System::OnSoftBodyInternalDestroy (Engine::Core::Registry &registry, Engine::EntityId entityId)
void Physics::System::InitSoftBodySystem (Engine::Core &core)
 Initialize the soft body system.
void Physics::System::ShutdownSoftBodySystem (Engine::Core &core)
 Shutdown the soft body system.
void Physics::System::SyncSoftBodyVertices (Engine::Core &core)
 Synchronize soft body vertex positions to mesh data.