TheAtlasEngine
 
Loading...
Searching...
No Matches
jolt_components.hpp
1#pragma once
2
3#include <glm/glm.hpp>
4#include <cstdint>
5#include <thread>
6#include <Jolt/Jolt.h>
7#include <Jolt/Physics/PhysicsSystem.h>
8#include <Jolt/Physics/Collision/ContactListener.h>
9
10namespace atlas::physics {
11 enum thread_type : uint8_t {
12 default_system = 0,
13 job_system = 1,
14 };
15
21 struct jolt_config {
22 // Global gravity vector for all in scene
23 glm::vec3 gravity = glm::vec3(0.0f, -9.80665f, 0.0f);
24
26 float time_before_sleep = 5.0f;
27
28 // What 1 unit refers to in meters
29 float world_unit_scale = 1.0f;
30
31 // Helps stop the lauching of objects during numerical/flaoting point
32 // errors when collision happen bertween to objects.
33 float contact_bias_factor = 0.2f;
34 float restitution_threshold = 1.0f;
35
36 bool enable_constraints = true;
37 bool enable_collision_callbacks = true;
38 };
39
54
55 uint32_t allocation_amount = 10 * 1024 * 1024;
56
58 thread_type thread_type = thread_type::default_system;
59
60 uint32_t physics_threads =
61 std::max(1u, std::thread::hardware_concurrency() - 2);
62
63 uint32_t max_jobs_power = 10;
64 uint32_t max_barriers = physics_threads * 16;
65 bool enable_multithread = true;
66
67 // Max memory size per scene
68 uint32_t max_bodies = 16384;
69 uint32_t max_body_pairs = 32768;
70 uint32_t max_contact_constraints = 8192;
71 };
72
73 // This might be able to be generalized eventually but we will have to
74 // create our own manifold before that happens.
76 uint64_t entity_a = 0;
77 uint64_t entity_b = 0;
78 JPH::ContactManifold manifold;
79 JPH::ContactSettings settings;
80 };
81
82};
Types are still be filled out. When this is completed to_jph() can be removed.
Definition jolt_broad_phase.hpp:5
Definition jolt_components.hpp:75
Used to keep global data for player access and use. Tells how physics bodies should act within a give...
Definition jolt_components.hpp:21
float time_before_sleep
In seconds.
Definition jolt_components.hpp:26
Jolt-specific context configurations These are going to be internally integrated to jolt_context.
Definition jolt_components.hpp:53