Scene loading/saving improvements, transform gizmo, entity creation

This commit is contained in:
2024-10-19 19:45:04 +02:00
parent fae8ea7cba
commit 3d98ba0023
15 changed files with 985 additions and 460 deletions

View File

@@ -31,6 +31,10 @@ Engine_Core :: struct {
time_buffer : Buffer_Handle;
screen_data_buffer : Buffer_Handle;
directional_light_buffer : Buffer_Handle;
procs: struct {
on_scene_loaded: (*Scene, Engine_Mode);
}
}
engine: Engine_Core;
@@ -92,16 +96,22 @@ coven_run :: (game_update_proc: (float), game_update_post_physics_proc: (float))
ui_begin();
game_update_proc(min(0.4, dt));
clamped_dt := min(0.4, dt);
update_animators(dt);
#if EDITOR {
base_editor_update();
}
if engine.mode == .PLAYING {
game_update_proc(clamped_dt);
update_animators(clamped_dt);
update_physics(engine.current_scene, clamped_dt);
game_update_post_physics_proc(clamped_dt);
}
update_physics(engine.current_scene, dt);
update_transforms();
game_update_post_physics_proc(dt);
sync_engine_buffers();
update_particle_systems(dt);
update_particle_systems(clamped_dt);
ui_end();
@@ -115,6 +125,18 @@ coven_run :: (game_update_proc: (float), game_update_post_physics_proc: (float))
SDL_Quit();
}
switch_engine_mode :: (to_mode: Engine_Mode) {
engine.mode = to_mode;
#if EDITOR {
engine.editor.selected_entities.count = 0;
}
if engine.current_scene != null {
reload_scene(engine.current_scene);
}
}
#if NETWORKING {
#load "networking/networking.jai";
}