Toast Engine
Loading...
Searching...
No Matches
physics_settings.hpp
Go to the documentation of this file.
1
6
7#pragma once
8#include <cstdint>
9#include <glm/glm.hpp>
10#include <toast/export.hpp>
11
12namespace physics {
13
14struct Tunables {
15 glm::vec3 gravity {0.0f, 0.0f, -9.8f};
16 uint32_t solver_iterations = 8;
17 float penetration_slop = 0.005f;
18 float correction_beta = 0.2f;
19 float max_correction = 0.05f;
20 float bounce_threshold = 1.0f;
21 float sleep_linear_threshold = 0.05f;
22 float sleep_angular_threshold = 0.05f;
23 float sleep_delay = 0.5f;
24 float sleep_drift = 0.05f;
25 double frequency = 60.0;
26 uint32_t max_substeps = 8;
27 double max_burst_seconds = 0.1;
28 float broadphase_fat_margin = 0.1f;
29 uint32_t max_connectivity_jobs_per_tick = 24;
30 uint32_t max_fragment_spawns_per_step = 8;
31 uint32_t max_active_fragments = 96;
32 uint32_t fragment_pool_headroom = 4096;
33 uint32_t min_fragment_voxels = 4;
34 uint32_t fragment_despawn_max_voxels = 16;
35 uint32_t large_debris_min_voxels = 16;
36 float fragment_despawn_settle_seconds = 3.0f;
37 float force_sleep_slack = 4.0f;
38 float fragment_sleep_scale = 3.0f;
39 int32_t max_fragment_extent_bricks = 1;
40 float fracture_shell_voxels = 1.0f;
41 float fracture_depth_share = 0.5f;
42 float fracture_max_depth = 2.0f;
43 float fracture_max_overshoot = 2.0f;
44 float fracture_bond_cost = 1.0f;
45 uint32_t fracture_max_unglue_voxels = 4096;
46 float fracture_debris_split_chance = 0.35f;
47 uint32_t fracture_max_shatter_cells = 128;
48 float fracture_max_shatter_distance = 8.0f;
49 uint32_t debris_max_spawns_per_step = 512;
50 float debris_speed_scale = 1.0f;
51 float debris_lifetime = 60.0f;
52 uint32_t debris_max_particles = 16384;
53 float debris_restitution = 0.3f;
54 float debris_friction = 0.6f;
55 float explosion_max_radius = 8.0f;
56 float explosion_falloff = 2.0f;
57 uint32_t impact_max_hardness = 1;
58 uint32_t min_bounds_per_job = 32;
59 uint32_t min_candidates_per_job = 2;
60 uint32_t min_manifolds_per_job = 4;
61 uint32_t min_shapes_per_query_job = 16;
62 uint32_t min_bodies_per_job = 64;
63 uint32_t min_wave_constraints_for_dispatch = 512;
64 uint32_t box_voxel_split_min_voxels = 500000;
65 uint32_t voxel_voxel_split_min_voxels = 250000;
66 uint32_t voxel_pair_split_regions = 8;
67 uint32_t sweep_refine_iterations = 6;
68 uint32_t position_iterations = 3;
69 float air_density = 1.225f;
70 glm::vec3 wind = {0.0f, 0.0f, 0.0f};
71 float wind_shelter_distance = 64.0f;
72
73 [[nodiscard]]
74 auto fixedDelta() const noexcept -> double {
75 return frequency > 0.0 ? 1.0 / frequency : 1.0 / 60.0;
76 }
77};
78
79[[nodiscard]]
80TOAST_API auto tunables() -> const Tunables&;
81
82TOAST_API void registerPhysicsSettings();
83
84}
Definition physics_settings.hpp:14