StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
PhysicsSystem.hpp
1#pragma once
2#ifdef StevEngine_PHYSICS
3#include "Layers.hpp"
4
5//Jolt imports
6#include <Jolt/Jolt.h>
7#include <Jolt/RegisterTypes.h>
8#include <Jolt/Core/Factory.h>
9#include <Jolt/Core/TempAllocator.h>
10#include <Jolt/Core/JobSystemThreadPool.h>
11#include <Jolt/Physics/PhysicsSettings.h>
12#include <Jolt/Physics/PhysicsSystem.h>
13#include <Jolt/Core/JobSystemSingleThreaded.h>
14#include <Jolt/Physics/Collision/Shape/BoxShape.h>
15#include <Jolt/Physics/Collision/Shape/SphereShape.h>
16#include <Jolt/Physics/Collision/Shape/MutableCompoundShape.h>
17#include <Jolt/Physics/Body/BodyManager.h>
18#include <Jolt/Physics/Body/BodyCreationSettings.h>
19#include <Jolt/Physics/Body/BodyActivationListener.h>
20
21namespace StevEngine {
22 class Engine;
23 namespace Physics {
31 friend class StevEngine::Engine;
32 public:
37
42 void Init(JPH::PhysicsSettings settings);
43
48 JPH::BodyInterface* GetBodyInterface() const { return bodyInterface; }
49
50 private:
55 void Update(double deltaTime);
56
57 JPH::PhysicsSystem joltSystem;
58 JPH::BodyInterface* bodyInterface;
59 JPH::TempAllocatorMalloc tempAllocator;
60 JPH::JobSystemSingleThreaded jobSystem;
61
62 // Layer management
63 BPLayerInterfaceImpl broad_phase_layer_interface;
64 ObjectVsBroadPhaseLayerFilterImpl object_vs_broadphase_layer_filter;
65 ObjectLayerPairFilterImpl object_vs_object_layer_filter;
66 };
67
68 extern PhysicsSystem physics;
69 }
70}
71#endif
Main engine class managing core systems.
Definition Engine.hpp:27
Broad phase layer interface for Jolt.
Definition Layers.hpp:66
Filter for object layer collisions.
Definition Layers.hpp:110
Filter for broad phase layer collisions.
Definition Layers.hpp:93
void Init(JPH::PhysicsSettings settings)
Initialize physics system.
Definition PhysicsSystem.cpp:52
PhysicsSystem()
Create physics system.
Definition PhysicsSystem.cpp:49
JPH::BodyInterface * GetBodyInterface() const
Get physics body interface.
Definition PhysicsSystem.hpp:48