Physics optional

This commit is contained in:
2025-07-12 17:26:23 +02:00
parent 9dd12a55bf
commit 602dd870df
5 changed files with 66 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
#module_parameters(WITH_EDITOR := true, WITH_NETWORKING := false, action_type : Type, entity_fields: Type, scene_fields: Type);
#module_parameters(WITH_EDITOR := true, WITH_NETWORKING := false, WITH_PHYSICS := false, action_type : Type, entity_fields: Type, scene_fields: Type);
// TODO: Add a fallback, if none we're specified
_Custom_Entity_Fields :: entity_fields;
@@ -8,6 +8,7 @@ Action :: action_type;
EDITOR :: WITH_EDITOR;
DEBUG :: true;
NETWORKING :: WITH_NETWORKING;
PHYSICS :: WITH_PHYSICS;
#if EDITOR {
//#load "../editor/scene_editor.jai";
@@ -83,7 +84,9 @@ coven_init :: (window_title: string, window_width: u32, window_height: u32, full
init_audio_system();
init_console();
init_physx();
#if PHYSICS {
init_physx();
}
#if EDITOR {
init_editor();
@@ -158,11 +161,14 @@ coven_run :: (game_update_proc: (float), game_editor_update_proc: (float), game_
if engine.current_scene != null && !engine.paused {
update_animators(clamped_dt);
pre_physx_sync(engine.current_scene);
tick_physx(*engine.current_scene.physx_scene, clamped_dt);
post_physx_sync(engine.current_scene);
#if PHYSICS {
pre_physx_sync(engine.current_scene);
tick_physx(*engine.current_scene.physx_scene, clamped_dt);
post_physx_sync(engine.current_scene);
game_update_post_physics_proc(clamped_dt);
// TODO: Move this out into engine.procs
game_update_post_physics_proc(clamped_dt);
}
}
} else {
game_editor_update_proc(clamped_dt);
@@ -214,6 +220,10 @@ switch_engine_mode :: (to_mode: Engine_Mode) {
}
}
#if PHYSICS {
#load "physics/physx.jai";
}
#if NETWORKING {
#load "networking/networking.jai";
}
@@ -238,7 +248,6 @@ switch_engine_mode :: (to_mode: Engine_Mode) {
#load "core/console.jai";
#load "audio/audio.jai";
#load "core/fps.jai";
#load "physics/physx.jai";
#scope_export