#pragma once #include #include "Rigibody.h" #include "src/Core/Timestep.h" #include "src/Core/Core.h" #include #include "RaycastResult.h" #include #include "CharacterController.h" #include namespace JPH { class PhysicsSystem; class JobSystemThreadPool; class ContactListener; class BodyActivationListener; class BodyInterface; } namespace Nuake { class BPLayerInterfaceImpl; class MyContactListener; class MyBodyActivationListener; namespace Physics { class DynamicWorld { private: uint32_t _stepCount; Ref _JoltPhysicsSystem; JPH::JobSystemThreadPool* _JoltJobSystem; Scope _contactListener; Scope _bodyActivationListener; JPH::BodyInterface* _JoltBodyInterface; BPLayerInterfaceImpl* _JoltBroadphaseLayerInterface; std::vector _registeredBodies; public: DynamicWorld(); void DrawDebug(); void SetGravity(glm::vec3 g); void AddRigidbody(Ref rb); void AddGhostbody(Ref gb); void AddCharacterController(Ref cc); RaycastResult Raycast(glm::vec3 from, glm::vec3 to); void StepSimulation(Timestep ts); void Clear(); }; } }